I use afnetworking to upload.When phone call received upload process becomes failure.What should i do?
MY Codes for uploading:
NSMutableDictionary *paraDict=[[NSMutableDictionary alloc]init];
[paraDict setObject:str_ImageData forKey:Content];
[paraDict setObject:str_ImageName forKey:Name];
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];
NSLog(@"%@",str_ImageName);
NSLog(@"tamam");
AFHTTPRequestOperation *requestOperation = [manager HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseData) {
[requestOperation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
double percentDone = (double)totalBytesWritten / (double)totalBytesExpectedToWrite;
NSLog(@"progress updated(percentDone) : %f", percentDone);
progressView2.progress = percentDone;
}];
Follow these steps
1- go to target section .
2- then Capabilities.
3- then background moode.
4- On background mode.
5- tick whatever u want to perform in background .
Hope it will help u
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.