Face book connect is not working
I have integrated Facebook connect in my iphone application.
when user clicks on a button i am calling a method which has the following c开发者_StackOverflow中文版ode.
session1 = [[FBSession sessionForApplication:kApiKey secret:kApiSecret delegate:self] retain];
dialog = [[[FBLoginDialog alloc] initWithSession:session1] autorelease];
[dialog show];
when the user login into the Facebook with his username and password, if the user name and password are incorrect it is showing the message correctly.
but when the user enters correct user name and password, the entire face book window is closing without giving any message.
Vodkhang has the right answer, but also know that since Facebook connect stores info in the user defaults, you should insert a
if (![session1 resume]) {
before you invoke the dialog. This will ensure that future uses of the app will not generate the same login dialog.
The didLogin: delegate function will still be invoked when the session is resumed, so you can still do whatever you need with the FBUID. One simple thing you can do is create a hidden Label in Interface Builder and assign the FBUID to that label in the didLogin function. That way you can always pull that label's text if you need the FBUID later.
It works correctly. The facebook window closes mean your user login successfully. You should handle some delegate:
#pragma mark FBSessionDelegate
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
}
- (void)sessionDidNotLogin:(FBSession*)session {
}
- (void)session:(FBSession*)session willLogout:(FBUID)uid {
}
- (void)sessionDidLogout:(FBSession*)session {
// NCLog(@"FacebookHelper logged out");
}
Then you will know what happens to the login process
精彩评论