我在我的项目中使用AFNetworking 3.0下载多个文件。我想显示所有文件的单个下载进度。我将每个文件下载的每个子进度添加到父进程。但它没有用,应用程序崩溃了。我收到了错误 -
public static int[] f (final int[] nums, int target) {
int[] r = new int[2];
r[0] = -1;
r[1] = -1;
int[] vIndex = new int[0Xfff];
for (int i = 0; i < nums.length; i++) {
int delta = 0Xff;
int gapIndex = target - nums[i] + delta;
if (vIndex[gapIndex] != 0) {
r[0] = vIndex[gapIndex];
r[1] = i + 1;
return r;
} else {
vIndex[nums[i] + delta] = i + 1;
}
}
return r;
}
这是我的下载课程 -
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<DownloadManager: 0x7f92e2f6e130>: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled.
Key path: fractionCompleted
答案 0 :(得分:2)
您忘记实施observeValueForKeyPath:ofObject:change:context:
方法。
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary<NSString *, id> *)change
context:(void *)context {
if ([keyPath isEqualToString:@"fractionCompleted"]) {
// process value
}
}