I just started a new application with iOS 3.1 SDK, I noticed that read and write permissions are now separate.
I'm looking for an easy way to post to a userโs wall, but I'm a little confused with the authorization mechanism
If I can write permissions in the CompletionHandler openActiveSessionWithReadPermissions, I get the following error
*** Terminating app due to uncaught exception 'com.facebook.sdk:InvalidOperationException', reason: 'FBSession: It is not valid to reauthorize while a previous reauthorize call has not yet completed.'
completeHandler sounds like the action is complete, so I donโt understand what the problem is with this code.
Any suggestions?
-(void)askWritePerms
{
NSArray *permissions = [NSArray arrayWithObjects:@"publish_actions", nil];
[[FBSession activeSession] reauthorizeWithPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
}];
}
- (IBAction)publishFB:(id)sender
{
NSArray *permissions = [NSArray arrayWithObjects:@"email", nil];
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
[self askWritePerms];
}
source
share