如何在按需资源下载中完成部分进度?

时间:2016-01-11 08:28:34

标签: objective-c ios9 on-demand-resources

我想获得分数的进展,但我得到的是在请求开始时为0,在下载结束时为1。这是我写的代码

    [self.resourceRequest.progress addObserver:self forKeyPath:@"fractionCompleted" options:NSKeyValueObservingOptionNew context:@"observeForrestLoad"];

    - (void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id)object change:(nullable NSDictionary *)change context:(nullable void *)context {
            if((object == self.resourceRequest.progress) && [keyPath isEqualToString:@"fractionCompleted"]) {
            // Do something with self.resourceRequest.progress.fractionCompleted
           NSLog(@"progress= %f",self.resourceRequest.progress.fractionCompleted);

    }
 }

任何人都可以告诉我如何在分数中确定进度?

0 个答案:

没有答案