Facebook graph api Facebook访问令牌已过期-iOS 6社交框架
我正在制作一个基于iOS6社交框架的应用程序……它工作正常,但几个月后出现了一个奇怪的错误 我将JSON Facebook数据导入NSDictionary的NSLog为:Facebook graph api Facebook访问令牌已过期-iOS 6社交框架,facebook-graph-api,ios6,facebook-access-token,Facebook Graph Api,Ios6,Facebook Access Token,我正在制作一个基于iOS6社交框架的应用程序……它工作正常,但几个月后出现了一个奇怪的错误 我将JSON Facebook数据导入NSDictionary的NSLog为: profiledictionary: { error = { code = 190; "error_subcode" = 463; message = "Error validating access token: Session has expired at unix time 1365610034. The current
profiledictionary: {
error = {
code = 190;
"error_subcode" = 463;
message = "Error validating access token: Session has expired at unix time 1365610034. The current unix time is 1366032783.";
type = OAuthException;
似乎我的访问令牌已经过期,但iOS6社交框架不应该自动处理它吗
关于如何解决它以及如何避免将来出现类似问题的想法,以便我可以安全地发布一个真正的应用程序?最终得到了它…有必要检查NSDictionary是否有一个名为“error”的对象(在本例中,Facebook关于令牌过期的错误),如果有,请调用一个方法来续订帐户:
if([self.profileDictionary objectForKey:@"error"]!=nil)
{
[self attemptRenewCredentials];
}
-(void)attemptRenewCredentials{
[self.accountStore renewCredentialsForAccount:(ACAccount *)self.facebookAccount completion:^(ACAccountCredentialRenewResult renewResult, NSError *error){
if(!error)
{
switch (renewResult) {
case ACAccountCredentialRenewResultRenewed:
NSLog(@"Good to go");
[self getFacebookAccount];
break;
case ACAccountCredentialRenewResultRejected:
NSLog(@"User declined permission");
break;
case ACAccountCredentialRenewResultFailed:
NSLog(@"non-user-initiated cancel, you may attempt to retry");
break;
default:
break;
}
}
else{
//handle error
NSLog(@"error from renew credentials%@",error);
}
}];
}
我今天对你的问题和答案投了赞成票。你救了我的命!!!你到底在哪里发现的?非常感谢。