Tuesday, February 28, 2012

fbdidlogin never called...why??

So I have been working on an iOS project recently that needed to implement the Facebook iOS SDK. I was having some major problems getting the delegate function fbdidlogin to fire. I finally realized it was an error on Facebook's part.

In Facebook.m
- (void)authorize:(NSArray *)permissions {
  self.permissions = permissions;
  [self authorizeWithFBAppAuth:YES safariAuth:YES];
}

This code prevents the FB dialog from appearing which successfully calls fbdidlogin. In order to resolve this so that it works properly you must change the third line to:

[self authorizeWithFBAppAuth:NO safariAuth:NO];

This slight code alteration will force the FB dialog to show (instead of the native app or safari app). And you'll see that all works well now. Yay.

2 comments:

tpickens said...

You are a genius!!!!! Thanks for the post.

niranjan said...

after clicking facebook button login page comes.but after login again facebook button page comes..after clicking again it works fine....what is problem