I got an alert from facebook recently to notice me update the sdk and then I downloaded the latest version 4.13.1 (but the document said newest version is 4.11.0, it is weird)
I follow the tutorial on facebook developer to update it, including AppDelegate and plist. But I found FBSDKAccessToken will become nil after I do FBSDKGraphRequest
FBSDKLoginManager *login = [[FBSDKLoginManager alloc]init];
[login logInWithReadPermissions:@[@"email",@"user_events",@"user_friends"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *loginResult, NSError *error) {
if (error || loginResult.isCancelled)
{
[self showErrorAlert];
}
else if ([loginResult.grantedPermissions containsObject:@"email"] &&
[FBSDKAccessToken currentAccessToken])
{
//===Here FBSDKAccessToken is work fine===
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]initWithGraphPath:@"me/ids_for_business" parameters:nil HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
//===But here FBSDKAccessToken become nil===
NSDictionary *resultDic = result;
NSArray *dataArray = [resultDic valueForKey:@"data"];
if (!error && dataArray.count > 0)
{
[self parseFBData:dataArray tokenis:[FBSDKAccessToken currentAccessToken].tokenString type:type];
}
else
[self showErrorAlert];
}];
}
else
[self showErrorAlert];
}];
I use "FBSDKAccessToken nil" as keyword and google it, but the questions I found seem caused by relaunch app. Anyone meet the same problem like me?
Aucun commentaire:
Enregistrer un commentaire