I need to make a post on a my own fanpage as the admin. I created this code hopping that passing the id of the page "fbPageID" would leave the post on that page, but it actually leaves the post on my profile.
NSArray *publishPerms = @[@"manage_pages",@"publish_actions", @"publish_stream"];
[FBSession openActiveSessionWithPublishPermissions:publishPerms     defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:NO completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
        if (session.isOpen) {
            [FBRequestConnection startForPostStatusUpdate:self.textBox.text place:fbPageID tags:nil completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                if (error){
                    NSLog(@"error %@",error);
                }
                else{
                    NSLog(@"POSTED %@",result);
                }
            }];
        }
        else{
            NSLog(@"session not open");
        }
Step 1 - Import FBSDK in your project
Step 2 - Login Authentication
NSDictionary *params = @{
@"message": @"This is a test message",
                         };
/* make the API call */
FBSDKGraphRequest *request_ = [[FBSDKGraphRequest alloc]
                              initWithGraphPath:@"/me/feed"
                              parameters:params
                              HTTPMethod:@"POST"];
[request_ startWithCompletionHandler:^(FBSDKGraphRequestConnection   *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With