I need to add upload functionality and all is done except the progress indicator. I am using an NSOperation
to initiate the HTTP request, so uploads would happen in background. But by doing so NSURLConnection
delegates are not getting invoked.
//.h file
@interface FooNSOperation : NSOperation<NSURLConnectionDataDelegate>
...
@end
// .m file
@implementation FooNSOperation
...
- (void) main {
// Upload using NSURLRequest, NSURLConnection
// NSURLConnection sendAsynchronousRequest: queue: completionHandler:
}
- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
// This never gets invoked
}
@end
How can I get upload progress ?