无法从ios应用发布状态更新

无法从ios应用发布状态更新,ios,objective-c,facebook,facebook-graph-api,publish-actions,Ios,Objective C,Facebook,Facebook Graph Api,Publish Actions,我正在尝试在我的帐户上发布状态。我已经试了好几个小时了,但还是没能成功 - (void) shareStatusUpdateButtonClicked { if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) { [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/feed" parameters: @{ @"message" : @"hello wo

我正在尝试在我的帐户上发布状态。我已经试了好几个小时了,但还是没能成功

- (void) shareStatusUpdateButtonClicked {
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) {
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/feed" parameters: @{ @"message" : @"hello world"}HTTPMethod:@"POST"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
  if (!error) {
    NSLog(@"POST ID: %@",result);
  }
}];
}
else {
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithPublishPermissions:@[@"publish_actions"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
  if (!error) {
     NSLog(@"Permission  Granted");
     NSDictionary *params = @{@"message": @"This is a test message"};
     FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/feed" parameters:params HTTPMethod:@"POST"];
     [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,id result,NSError *error) {
       if(!error){
         NSLog(@"RESULT %@",result);
         NSLog(@"POSTED !");
       }
     }];
   }
   else{
     NSLog(@"ERROR PERMISSION NOT GRANTED");
   }
                                  }
 ];
}
}
问题是,当我运行应用程序时,它会检查用户是否在if表达式中允许“publish_actions”,如果失败,则执行else块,但它显示您已授权此应用程序。然后我单击Ok,但状态没有发布在我的facebook个人资料上。我不明白我错在哪里。任何帮助都会被姑息。
PS:我没有要求用户在代码中的任何其他地方授予“发布操作”权限。此外,我还尝试从facebook设置中删除该应用程序,但没有效果。

您不需要检查是否已批准。您可以检查是否有有效的访问令牌。if表达式无论如何都会失败,但这不会影响else部分,对吗?