1
我已經在info.plist文件中設置了FacebookAppID,FacebookDisplayName,URLSchemes。在我最初的viewController中,我有以下功能。Facebook ios sdk 3.10 openActiveSessionWithReadPermissions不使用網絡登錄回調
但是,在調用openActiveSessionWithReadPermissions之後,它不會被稱爲NSLog等等。
- (IBAction)facebookLoginButtonClickHandler:(id)sender
{
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"email", @"read_stream", @"user_about_me", @"user_birthday",
nil];
FBSession *session = [[FBSession alloc] initWithPermissions:permissions];
[FBSession setActiveSession:session];
[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:true completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
NSLog(@"session = %@", session);
NSLog(@"error = %@", error);
if (status == FBSessionStateClosedLoginFailed || status == FBSessionStateCreatedOpening) {
[[FBSession activeSession] closeAndClearTokenInformation];
[FBSession setActiveSession:nil];
} else if (!session.isOpen) {
[[FBSession activeSession] closeAndClearTokenInformation];
[FBSession setActiveSession:nil];
} else {
NSLog(@"accessToken = %@", session);
}
}];
}
的感謝!我可以做到這一點。 – naohide
在SDK 4中如何工作? – jose920405