Hello I am using FBSession to open login view it opens Safari for login in iOS5.0 and ios 6.0 Simulator but in ios 6.0 iPhone it is opening Facebook APP not safari.Please tell me what is reason and how can I solve it?Here is my code for Facebook login.
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
return [FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
/*
* Callback for session changes.
*/
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:
if (!error) {
// We have a valid session
NSLog(@"User session found");
if ([[IntegrationManager sharedInstance] facebookDidLogin:nil]) {
[self.window.rootViewController dismissModalViewControllerAnimated:YES];
};
}
break;
case FBSessionStateClosed:NSLog(@"Fbsession close");
case FBSessionStateClosedLoginFailed:
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
[[NSNotificationCenter defaultCenter]
postNotificationName:FBSessionStateChangedNotification
object:session];
if (error) {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
For the user convenience the facebook app is started instead of the opening a website. It is done so the user does not have to login in again, it is also known as single sign on.
If you are using the Facebook iOS SDK there is nothing you can do about or should do about it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.