I upload multiple files using AFNetworking 3.0 in my project. I want to show one download of all files. I added that every progress of each file is uploaded to the original process. But this does not work, the application crashed. I get an error -
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<DownloadManager: 0x7f92e2f6e130>: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: fractionCompleted
Here is my loading class -
@interface DownloadManager () @property (nonatomic, strong) NSProgress *progress; @property (nonatomic, strong) Settings *settings; @property (nonatomic, strong) DocumentDirectory *documentDirectory; @end @implementation DownloadManager - (instancetype)init { self = [super init]; if (self) { self.progress = [NSProgress new]; [self.progress addObserver:self forKeyPath:@"fractionCompleted" options:NSKeyValueObservingOptionNew context:NULL]; self.settings = [Settings new]; self.documentDirectory = [DocumentDirectory new]; } return self; } - (void) dealloc { [self.progress removeObserver:self forKeyPath:@"fractionCompleted"]; }
source share