Facebook graph api 将带有页面访问令牌的FBSession更改为以管理员身份发布fb页面上的帖子

Facebook graph api 将带有页面访问令牌的FBSession更改为以管理员身份发布fb页面上的帖子,facebook-graph-api,facebook-ios-sdk,Facebook Graph Api,Facebook Ios Sdk,我想在facebook页面上以管理员的身份发布帖子,其中用户是该页面的管理员。 我有来自的页面访问令牌 [FBRequestConnection startWithGraphPath:@"/me/accounts" parameters:nil HTTPMethod:@"GET" com

我想在facebook页面上以管理员的身份发布帖子,其中用户是该页面的管理员。 我有来自的页面访问令牌

[FBRequestConnection startWithGraphPath:@"/me/accounts"
                                       parameters:nil
                                     HTTPMethod:@"GET"
                              completionHandler:^(
                                                  FBRequestConnection *connection,
                                                  id result,
                                                  NSError *error
                                                  ) {
                              NSString *token = [[[result objectForKey:@"data"] objectAtIndex:0] objectForKey:@"access_token"];//accessToken of the page
}];
现在,我如何使用此令牌更改FBSession以使用GraphAPI作为管理员在页面上发布帖子?FBI文件中提到了这一点。请帮助我,因为我被困在这个很长时间。我正在使用facebook sdk 3.2。提前谢谢

NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys:token, @"access_token",
                                                         titleCell.titleTextView.text,@"message",
                                                         [UserDefaultsManager fbPlaceId], @"place",
                                                         //                                          fbPhotoId,@"object_attachment",
                                                         @"https://www.google.com",@"link",
                                                         photoUrl,@"picture",
                                                         titleCell.titleTextView.text,@"name",
                                                         typeCell.cellTextField.text,@"caption",
                                                         descriptionCell.descriptionTextView.text,@"description",
                                                         nil];

                                      FBRequest *requestToPost = [[FBRequest alloc] initWithSession:nil
                                                                                    graphPath:@"/me/feed"
                                                                                   parameters:param
                                                                                   HTTPMethod:@"POST"];

                                      FBRequestConnection *requestToPostConnection = [[FBRequestConnection alloc] init];
                                      [requestToPostConnection addRequest:requestToPost completionHandler:^(FBRequestConnection *connection, id result, NSError *error){
                                          if(!error)
                                          {
                                              NSLog(@"facebook result >> %@", result);

                                              NSData *photoData = UIImagePNGRepresentation(promoImage);

                                              NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys:token,@"access_token",
                                                                               photoData,@"source", nil];

                                              FBRequest *requestToPostPhoto = [[FBRequest alloc] initWithSession:nil
                                                                                             graphPath:@"/me/photos"
                                                                                            parameters:param
                                                                                            HTTPMethod:@"POST"];

                                              FBRequestConnection *requestToPostPhotoConnection = [[FBRequestConnection alloc] init];
                                              [requestToPostPhotoConnection addRequest:requestToPostPhoto completionHandler:^(FBRequestConnection *connection, id result, NSError *error){
                                                  if(!error)
                                                  {
                                                      [loadingAlert dismissWithClickedButtonIndex:0 animated:YES];
                                                      NSLog(@"facebook result photo>> %@", result);

                                                      doneAlert = [[UIAlertView alloc]          initWithTitle:@"Success"
                                                                                                      message:@""
                                                                                                     delegate:self
                                                                                            cancelButtonTitle:@"OK"
                                                                                            otherButtonTitles:nil];
                                                      if(self.isUpdatingPromo)
                                                      {
                                                          doneAlert.message = @"Promo updated successfully";
                                                          [doneAlert show];
                                                      }
                                                      else
                                                      {
                                                          doneAlert.message = @"Promo created successfully";
                                                          [doneAlert show];
                                                      }
                                                  }
                                                  else
                                                  {
                                                      [loadingAlert dismissWithClickedButtonIndex:0 animated:YES];
                                                      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                                                                      message:@"Could not post photo"
                                                                                                     delegate:nil
                                                                                            cancelButtonTitle:@"Dismiss"
                                                                                            otherButtonTitles:nil];
                                                      [alert show];
                                                  }
                                              }];
                                              [requestToPostPhotoConnection start];
                                          }
                                          else
                                          {
                                              [loadingAlert dismissWithClickedButtonIndex:0 animated:YES];
                                              UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                                                              message:@"Could not post"
                                                                                             delegate:nil
                                                                                    cancelButtonTitle:@"Dismiss"
                                                                                    otherButtonTitles:nil];
                                              [alert show];
                                          }
                                      }];
                                      [requestToPostConnection start];