iPhone app crashes after first Facebook Connect authorization / login

我与影子孤独终老i 提交于 2019-12-10 17:36:40

问题


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 user 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.


回答1:


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;


来源:https://stackoverflow.com/questions/7178962/iphone-app-crashes-after-first-facebook-connect-authorization-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!