Request additional permission Facebook SDK 4 iOS

I have an application that logs in via facebook. When he logs in, I only asked for the "public_profile", "user_friends" and "email" permissions. I know that later on I can ask for permission, as FB stated:

"Your app can ask for additional permissions at any time, even after the user first logs in. For example, the publish_actions permission allows you to publish to Facebook Facebook Timeline. It recommends that you only request this permission when the person is ready to post the story to Facebook." ...

So when I was going to post to a user's wall, I want to ask for "publish_actions". Please tell us how to do this using the Facebook SDK. 4. Most of the answers related to FBSession, activeSession, requestNewPublishPermissions, etc., but the latest Facebook SDK (4.1.0) doesn't have an FBSession class.

+3


source to share


2 answers


You need to call the login method again to request a different permission.



FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithPublishPermissions:@[@"publish_actions"]
                                  handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
 {
     if ([result.declinedPermissions containsObject:@"publish_actions"])
     {
         // permission denied
     }
     else
     {
         // do something
     }
 }];

      

+8


source


For a Parse developer, this might be the answer.

PFFacebookUtils.linkUserInBackground(user, withPublishPermissions: ["publish_actions"], {
  (succeeded: Bool?, error: NSError?) -> Void in
  if succeeded {
    println("User now has read and publish permissions!")
  }
})

      



But I am still looking for a more general solution

+2


source







All Articles