您好我正在使用FBSession打开登录视图它打开Safari登录iOS5.0和ios 6.0模拟器,但在ios 6.0 iPhone中它打开Facebook APP没有safari.Please告诉我是什么原因,我该如何解决它?这是我登录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];
}
}
答案 0 :(得分:0)
为方便用户,启动facebook应用程序而不是打开网站。这样做是因为用户不必再次登录,也称为单点登录。
如果您使用的是Facebook iOS SDK,那么您无能为力或应该做些什么。