iPhone app crashes after first Facebook Connect authorization / login
I've been looking for an answer everywhere but couldn't find one.
The problem is:- I have an iPhone application (on the AppStore) which uses Facebook iPhone SDK.
- I'm using the SDK for authorizing the user in the following way:
NSArray *permissions = [NSArray arrayWithObjects: @"offline_access",
@"publish_stream", @"user_birthday", @"user_hometown", @"user_interests",
@"user_location", @"email" ,nil];
[((MyAppDelegate *)AppDelegate).facebook authorize:permissions delegate:self];
In the AppDelegate I have this code:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
return [self.facebook handleOpenURL:url];
}
And now:
- The SDK opens Safari and displays the well known facebook authorization screen. - User presses the "allow" button. - iOS tries to return to the app.. - But then - BAM! - CRASH! - Before application launched back!!VERY IMPORTANT:
- Users encounter this crash ONLY in their first launch of the app after installation. When they open the app again after the crash everything works perfectly and they're even signed-in
- This scenario cannot be reproduced afterwards even if the us开发者_如何学Pythoner uninstalls the app and install it again. it happens only on the first launch of the first installation.
Really need help here. 90% of my users get this crash on production.
Thanks a lot.in this line:
[((MyAppDelegate *)AppDelegate).facebook authorize:permissions delegate:self];
you set the delegate to self
so that class must implement FBSessionDelegate
with these functions:
(void)fbDidLogin;
(void)fbDidNotLogin:(BOOL)cancelled;
(void)fbDidLogout;
精彩评论