AFNetworking/AFNetworking — Issue #122:  Incompatible block pointer types
Author: AndrewGertig
Created: 2011-11-22 04:59:00+00:00
State: open

First off, great job getting the introduction to AFNetworking up, just checked this out for the first time a couple days ago and I believe it wasn't here then.

I grabbed this piece of code and it is throwing an "incompatible block pointer types" error on the success block.

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://gowalla.com/users/mattt.json"]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSLog(@"Name: %@ %@", [JSON valueForKeyPath:@"first_name"], [JSON valueForKeyPath:@"last_name"]);
} failure:nil];

More specifically the error is:

error: incompatible block pointer types sending 'void (^)(NSURLRequest *__strong, NSHTTPURLResponse *__strong, __strong id)' to parameter of type 'void (^)(NSURLRequest *__strong, NSURLResponse *__strong, __strong id)' [3]

I'm on XCode 4.2, Lion, iOS5 using ARC with the AFNetworking fix, SBJson 3.1 alpha 3.