Facebook SDK FBRequest requestForMe Incompatible pointer types

I am encountering problems trying to update my Facebook SDK to the latest release version (FacebookSDK-3.0.8.pkg - Facebook SDK 3.0 for iOS (update 1) [August 21, 2012]).

I follow the instructions on this page .

I ran into several problems trying to get the code to work, it is not as simple as declared in the tutorial. I can open a session, but cannot make the request work.

- (IBAction)facebookTapped:(id)sender { [FBSession openActiveSessionWithPermissions:nil allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { if(error) { NSLog(@"Error opening session: %@", error); return; } if(session.isOpen) { NSLog(@"session is open"); FBRequest *me = [FBRequest requestForGraphPath:@"me"]; [me startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *my, NSError *error) { NSLog(@"My name: %@", my.first_name); }]; } }]; } 

My console displays that the session is open if I delete the FBRequest requestforGraphpath call. If I leave it, I get the error "Incompatible block pointer types" void (^) (struct FBRequestConection, struct NSDictionary, struct NSError *) ', expected by' FBRequestHandler '

Now what puzzled me was the exact code shown in the tutorial, excpet, which I modified [FBRequest requestForMe], trying to use different approaches. Nothing worked.

Can anyone shed some light on this for me?

Thanks.

+7
source share
1 answer

I managed to solve this problem by changing the source block in the tutorial:

 if (session.isOpen) { FBRequest *me = [FBRequest requestForMe]; [me startWithCompletionHandler: ^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *my, NSError *error) { self.label.text = my.first_name; }]; } 

to

 if(session.isOpen) { FBRequest *me = [FBRequest requestForMe]; [me startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) { NSDictionary<FBGraphUser> *my = (NSDictionary<FBGraphUser> *) result; NSLog(@"My dictionary: %@", my.first_name); }]; } 
+7
source

All Articles