I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog:
FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:session] autorelease];
[dialog show];
(Note that the results are the same when I go with the FBLoginButton approach instead of showing the dialog directly.)
The dialog pops up as expected, but as you see in the screenshot below, it is way too large and looks like the full Facebook homepage. I can pan the dialog to reveal the login button, but once I log in it proceeds to show the regular Facebook page inside the dialog. It never calls my session:didLogin callback.
Is there something I’m doing wrong?
alt text http://img.skitch.com/20091115-t24w7p5gpa6iqgehjdc4f1awfs.jpg
I finally figured it out… I was initializing the
FBSessioninside my app delegate’sapplicationDidFinishLaunchingmethod. I then triggered the Facebook login code in my view controller’sviewDidAppear.However,
applicationDidFinishLaunchinglooked like this:This means that I was showing the window before I was initializing the
FBSession, and apparently a nil session leads to the behavior I described above. After changingapplicationDidFinishLaunchingto create theFBSessionfirst, everything now works as expected. Doh… 😉