Facebook API for iPhone Error: An active access token must be used
I am trying to retrieve my online friends and I am 开发者_Go百科getting this error:"An active access token must be used to query information about the current user."
This is my method:`-(IBAction)act:(id)sender{
NSArray* permissions = [[NSArray arrayWithObjects:
@"user_online_presence", @"friends_online_presence", nil] retain];
[facebook authorize:permissions delegate:self];
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
NSLog(@"dd");
NSLog(@"%@",facebook.accessToken);
} ` What I am doing wrong here?
you are not waiting for the authorization to complete.
You will need to implement the didLogin delegate method, and
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
should go only after didLogin was called.
精彩评论