![](/img/trans.png)
[英]Facebook login in IOS works on emulator but not on device with native app installed
[英]Facebook Login is opening in Facebook Native app not in safari browser on iphone device with ios 6.0
您好,我正在使用FBSession打开登录视图,它在iOS5.0和ios 6.0 Simulator中打开了Safari进行登录,但是在ios 6.0 iPhone中,它正在打开不是野生动物园的Facebook APP。请告诉我这是什么原因,怎么解决?我的Facebook登录代码。
- (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];
}
}
为了用户方便,启动了Facebook应用程序,而不是打开网站。 这样做是为了使用户不必再次登录,这也称为单点登录。
如果您使用的是Facebook iOS SDK,那么您将无能为力。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.