FBSDKLoginManager logInWithReadPermissions?

旧城冷巷雨未停 提交于 2019-12-02 22:32:30

Facebook Login provides your app access to a person's public profile, friend list, and email address. These three permissions do not require review. Instead, your app's users will choose whether they want to grant access to this information.

In order for your app to access additional elements of a person's Facebook profile (read permissions) or to publish content to Facebook on their behalf (write permissions), you will need to submit for review.

Refer to : https://developers.facebook.com/docs/apps/review#submitlogin

Updated :

Apps should separate the request of read and publish permissions.

 FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

    [login logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
        if (error) {
            // Process error
        } else if (result.isCancelled) {
            // Handle cancellations
        } else {
            // If you ask for multiple permissions at once, you
            // should check if specific permissions missing
            if ([result.grantedPermissions containsObject:@"publish_actions"]) {
                // Do work

                [login logInWithReadPermissions:@[@"user_likes",@"user_birthday"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
                    if (error) {
                        // Process error
                    } else if (result.isCancelled) {
                        // Handle cancellations
                    } else {
                        // If you ask for multiple permissions at once, you
                        // should check if specific permissions missing
                        if ([result.grantedPermissions containsObject:@"user_birthday"]) {
                            // Do work

                            NSLog(@"Permission  2: %@",result.grantedPermissions);
                        }
                    }
                }];

            }
        }
    }];

You don't need public_profile in read permission as if granted permission to publish_actions it also gets permission for public_profile.

As i seen you code that you are trying to use the "user_likes", "user_birthday", "public_profile" and "publish_actions" permissions.

From 1st May 2015 facebook has only enabled "public_profile", "email" and "user_friends" are available without the approval process.

For "user_likes", "user_birthday" and "publish_actions" you need to get approval from the facebook.

For review process you can get help from Facebook Review.

I also have the same issue with user_posts permission for two weeks, but after some search i found the solution for this, if you still having this issue follow these steps

  1. Go to http://developers.facebook.com and logged in to your developer account.
  2. Select your app and go to Roles section.
  3. Add a tester in Testers section.
  4. Then re-install the app and login using that tester account.
  5. Now you try to get the required permissions from tester and tester will see all the permissions list.
var login = FBSDKLoginManager()


@IBAction func fbBtnPressed(_ sender: AnyObject) {

    login.logIn(withReadPermissions: ["email"], from: self) { (FBSDKLoginManagerLoginResult, Error) in

        if Error != nil {
            print("O Login via Facebook Falhou. Erro: \(Error)")
        } else {
            let accessToken = FBSDKAccessToken.current().tokenString
            self.gotoScreen() //Function for screen after login succesfull 
            print("Acesso concedido ao Facebook. \(accessToken)")
        }

    }

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!