基本的に、このページを通過して、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を表示したくありません。手伝って頂けますか?