こんにちは私はFBSessionを使用してログインビューを開きますiOS5.0およびiOS6.0シミュレーターでログインするためにSafariを開きますが、iOS6.0iPhoneではサファリではなくFacebookAPPを開きます理由とその解決方法を教えてください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];
}
}