I want to get the progress in fractions but what I get is 0 at the beginning of the request and 1 at the end of the download. Here is the code I have written
[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);
}
}
Can anyone tell how do I get the progress determinately in fractions?