iOS FBSDK가 만료 된 토큰을 반환 할 때 대소 문자를 처리하는 방법을 모르겠습니다. 내 애플 리케이션에서 나는 '로그인'버튼을 클릭 할 때 다음과 같은 메소드를 호출한다.FBSDK 토큰 만료 된 경우를 처리하는 방법은 무엇입니까?
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"public_profile", @"email", @"user_photos", @"user_birthday"]
fromViewController:nil
handler: etc.... ]
이 다음 FBSDKAccessTokenDidChangeNotification 트리거, 다음과 같이 나는이 방법을 handeling 해요 :
- (void)fbAccessTokenDidChange:(NSNotification *)notification
{
if ([notification.name isEqualToString:FBSDKAccessTokenDidChangeNotification]) {
FBSDKAccessToken* oldToken = [notification.userInfo valueForKey: FBSDKAccessTokenChangeOldKey];
FBSDKAccessToken* newToken = [notification.userInfo valueForKey: FBSDKAccessTokenChangeNewKey];
NSLog(@"FB access token did change notification\nOLD token:\t%@\nNEW token:\t%@", oldToken.tokenString, newToken.tokenString);
// initial token setup when user is logged in
if (newToken != nil && oldToken == nil)
{
NSDate *nowDate = [NSDate date];
NSDate *fbExpirationDate = [FBSDKAccessToken currentAccessToken].expirationDate;
if ([fbExpirationDate compare:nowDate] != NSOrderedDescending)
{
NSLog(@"FB token: expired");
if ([FBSDKAccessToken currentAccessToken])
{
[[FBSDKLoginManager new] logOut];
[[NSNotificationCenter defaultCenter] postNotificationName:@"fbTokenExpired" object:nil];
}
return;
}
[self storeFacebookToken];
}
else if (newToken && oldToken && ![oldToken.tokenString isEqualToString:newToken.tokenString])
{
NSLog(@"FB access token string did change");
[self storeFacebookToken];
}
}
}
내가 토큰이 만료되는 caase 위해 어떻게해야합니까? ?? 현재 토큰을 nil로 설정하는 [[FBSDKLoginManager new] logOut]을 호출합니다. 그러나 사용자를 다시 로그인 버튼 동작으로 리디렉션하면 '허용'을 누르라는 동일한 창이 나타납니다. 사용자에게 암호와 전자 메일을 입력하도록 요청하지는 않습니다. 이해할 때 새 토큰을 만들 수 있습니까? 그 점을 어디에서 놓치고 있습니까? 지금은 사용자가 로그인하지 않고 루프에 들어가기 만하면 ...
도움이 많이 감사합니다! 장치에있는 당신의 페이스 북 응용 프로그램에서 Thnx
Thnx 그러나 이것은 좋은 해결책이 아닙니다. 이 내용을 사용자에게 어떻게 표시해야합니까? 어떻게 든이 프로그램 방식으로 장면 뒤에서 할 필요가 있고, 사용자에게 fb 앱과 로그 아웃으로 이동하지 말라고 ... – user1974507