您好,我正在使用 FBSession 打开登录视图,它打开 Safari 以在 iOS5.0 和 ios 6.0 模拟器中登录,但在 ios 6.0 iPhone 中打开 Facebook APP 而不是 safari。请告诉我是什么原因,我该如何解决?这里是我的 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];
}
}