Reputation:
I want to send my files in background mode but when i switch to background uploading stops.But there is no problem while sending video.i sending video post method.However i send my images as string...
my way to start operation
[[AFHTTPRequestOperationManager manager].operationQueue addOperation:requestOperation];
initialize to post
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:[NSString stringWithFormat:@"%@%@",API_URL,Upload_Image] parameters:paraDict error:nil];
Other Codes :
[requestOperation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
MAINPATCH
double percentDone = (double)totalBytesWritten / (double)totalBytesExpectedToWrite;
NSLog(@"progress updated(percentDone) : %f", percentDone);
progressView2.progress = percentDone;
patchEND
}];
handling
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
Upvotes: 0
Views: 65