I am trying to use AFNetworking 2.0 with NSURLSession. I am using the method
- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
fromFile:(NSURL *)fileURL
progress:(NSProgress * __autoreleasing *)progress
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler;
How am I supposed to use the progress parameter. The method is a non blocking method. Hence I will have to listen to the 'progress
' to get the updates. But the parameter wouldn't take a property. Only takes a local variable(NSProgress * __autoreleasing *). I can't add KVO to a local var.
I am not really sure how to use.
Any time an argument is given as
**
it means that you're supposed to pass in the pointer to the pointer to an existing object, not a pointer to the actual object as you would normally do.In this case, you pass in a pointer to a pointer to an
NSProgress
object and then observe the changes in that object in order to get the updates.Example:
Then it gets reported in: