I am developing an iPhone app that uses Facebook Connect to identify users. Everything worked fine until I upgraded my XCode to 4.2 from 4.0.
When the application launches and the user is prompted to login to Facebook, the Facebook app is suppose to take over.
The code that invokes the Facebook mechanism:Facebook *theFacebookSDK = [[Facebook alloc] initWithAppId:kZFBAppId];
NSArray *permissions = [NSArray arrayWithObjects:
@"user_birthday", @"publish_stream", @"offline_access",nil];
[theFacebookSDK authorize:permissions delegate:self];
When I test it on the device, all is good.
When I test it on the iPhone Simulator, it opens Safari with some URL that the Facebook SDK generates.
But instead of allowing me to "Allow" the Facebook app, the web page is empty and has a navigation bar at the top with title "Add to Facebook", and a ba开发者_如何学运维r button item on the right side that says "Okay". Tapping the "Okay" button gives a similar page with title "Error" and an error string: "An error occurred with FacebookAppName. Please try again later." And of course, when I try later, the same thing happens.Anyone knows how to fix this? I want to continue developing on the simulator...
The problem was a unreported bug of Facebook. It is now fixed
Doublecheck the value of kZFBAppId above as well as ensure its included in your .plist as per http://developers.facebook.com/docs/mobile/ios/build/. I've run into this same issue (the iOS simulator wouldn't present the auth dialog properly) and it was because 'kZFBAppId' at the point of the call was null. (race condition)
精彩评论