Request additional permission Facebook SDK 4 iOS

I have an app that log in through facebook. When it log in, I only asked for "public_profile", "user_friends" and "email" permission. I know that I can ask for more permission later on, as FB stated:

"Your app can ask for additional permissions at any time, even after a person logs in for the first time. For example, the publish_actions permission lets you post to a person's Facebook Timeline. It's recommended you ask for this permission only when a person is ready to publish a story to Facebook."

So when I was about to post to user's wall, I want to ask for "publish_actions". Please tell me how to do it with Facebook SDK 4. Most of the answer relating to FBSession, activeSession, requestNewPublishPermissions, etc., but in latest Facebook SDK (4.1.0), there is no FBSession class.


您必须再次调用登录方法才能请求另一个权限。

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
     }
 }];

For Parse Developer, it can be an 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

链接地址: http://www.djcxy.com/p/83146.html

上一篇: 将类添加到默认选中复选框和收音机标签

下一篇: 请求额外的许可Facebook SDK 4 iOS