Can Poyrazoğlu
Can Poyrazoğlu

Reputation: 34830

requestNewReadPermissions equivalent on Facebook iOS SDK v4

I'm having trouble finding the requestNewReadPermissions equivalent after upgrading to Facebook iOS SDK 4.x from 3.x. How do I force the system to re-ask for some permissions that user has not granted?

Upvotes: 0

Views: 251

Answers (1)

Laurent
Laurent

Reputation: 1584

You need to check the current accesstoken's permissions for the one that you will require to launch a feature, and launch the permission request if the permission is missing:

if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) {
  // HERE you implement the feature that requires publish actions.
} else {
  FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
  [loginManager logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    //TODO: if the user granted the permission, launch the feature. If not, fail gracefully.
  }];
}

Upvotes: 1

Related Questions