基本上我浏览了这个页面并实现了我的Facebook登录。
https://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/
接下来,当用户再次打开应用程序时,我尝试重新打开会话:
[appDelegate openSessionWithAllowLoginUI:NO];
//The method is:
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"email",
@"user_likes",
nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
但是FBSessionState总是0:
/*! One of two initial states indicating that no valid cached token was found */
FBSessionStateCreated = 0,
我尝试了几乎所有东西,使用FBSessionTokenCachingStrategy存储和恢复tokendata,但没有一个工作。如果我打电话
[appDelegate openSessionWithAllowLoginUI:YES];
并在会话开始时显示LoginUI,但我不希望每次都显示LoginUI。你能救我吗?