Facebook 上的 requestNewReadPermissions 等效 iOS SDK v4

requestNewReadPermissions equivalent on Facebook iOS SDK v4

从 3.x 升级到 Facebook iOS SDK 4.x 后,我找不到 requestNewReadPermissions 等效项。如何强制系统重新请求用户未授予的某些权限?

您需要检查当前 accesstoken 的权限,以获取启动一项功能所需的权限,如果缺少权限,则启动权限请求:

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