问题
I have upgraded the facebook in my ios app to 3.0 and using the code provided at https://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/ for user login through facebook , but the problem is that the after the user allows the facebook access the - (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
method is not being called. But the interesting part is that when i create a new application and integrate the same code in that application the same method is being called there.I am using xcode 4.4. Any suggestion why is it happening with my existing code.
回答1:
make sure you are have set the fburl, and appid well. If the device/simulator having more than apps which are using same facebook appId it may happen.
回答2:
Could this possibly be because your old app is set to not run in the background, as set in your app plist? I have been having this same problem. It seems that, if the app is left running in the background, it will return and call openURL. But if the app does not run in the background, it will return and call application:didFinishLaunchingWithOptions instead, and NOT call openURL. It is possible to get the url from the launch options:
NSURL *url = [launchOptions objectForKey: UIApplicationLaunchOptionsURLKey];
but I have not figured out how to call this so that it has the same effect as application:openURL when returning from Facebook authentication. Hope this helps some.
回答3:
updated the xcode to 4.5 GM for correct working , may be it was a problem with xcode previous version.
来源:https://stackoverflow.com/questions/12515922/application-open-url-method-not-called-after-user-authenticates-the-facebook