Reputation: 2817
I am using AFNetworking Framework for calling API and sometimes I am not getting any response from server while API call:
Here is my code snippet:
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
[manager.requestSerializer setTimeoutInterval:timeOutInterval];
[manager POST:[NSString stringWithFormat:@"%@%@",MainUrl,apiName] parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSArray *arrData = responseObject;
NSLog(@"%@",arrData);
NSString *strCode = [NSString stringWithFormat:@"%@",[arrData valueForKey:@"success"]];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[SVProgressHUD dismiss];
NSLog(@"Error: %@", manager);
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Message" message:@"Please check your internet connection" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}];
I get below error :
Error: <AFHTTPRequestOperationManager: 0x80010ce0, baseURL: (null), operationQueue: <NSOperationQueue: 0x80010ca0>{name = 'NSOperationQueue 0x80010ca0'}>
Any help will be appreciated.
In ios 9.1 AFNetworking 2.5
Upvotes: 1
Views: 87