having an odd issue with AFNetworking recently. I have a PHP backend and I'm using the SLIM framework. Simplified example of what is happening: If I use the link http://xxx.xxx.xx.xx/InstaAPI/hi this should be called:
$app->get('/hi', function() use($app) {
$app->response->setStatus(200);
echo "hiiii\n";
});
Now in my objective-c code I have:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@"http://xxx.xxx.xx.xx/InstaAPI/hi" parameters:nil success:^(AFHTTPRequestOperation * _Nonnull operation, id _Nonnull responseObject) {
NSLog(@"ok");
NSLog(@"%@",responseObject);
} failure:^(AFHTTPRequestOperation * _Nonnull operation, NSError * _Nonnull error) {
NSLog(@"fail");
NSLog(@"%@", operation.responseString);
}];
The result I'm getting in the output console is:
015-10-08 18:30:20.650 iReporter[12822:3214201] fail
2015-10-08 18:30:20.650 iReporter[12822:3214201] hiiii
Have no idea why it's calling the failure block. The status is after all set to 200 so it should be okay. Could someone give me some pointers to what I might be doing wrong here please?