You cannot "automatically", refresh the access token. Whenever you get the response, you should check for the error and if error exists renew the token. This code may help you-
....
if([json.profileDictionary objectForKey:@"error"]!=nil){
[self renewCredentials];
}
-(void)renewCredentials{
[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);
}
}];
}
Hope that helps!