I am trying to post on Facebook page as a page post. I using am below graph code API, but post coming on side as other people post, not as page admin/Page itself:
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
@"Testing Post", @"name",
@"This is testing", @"message",
@"this is description", @"description",
nil];
NSString *feed = [NSString stringWithFormat:@"/Page ID/feed"];
[FBRequestConnection startWithGraphPath:feed
parameters:params
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
if(!error){
NSLog(@"%@", result);
}
else{
NSLog(@"Error %@", error);
}
}];
If you want to post as the Page itself, you'll need to use a Page Access Token with the publish_pages
permission.
See
Here is Complete Answer
NSString *accesstoken = <Page_Access_Token>
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
@"Post heading", @"name",
accesstoken, @"access_token",
@"Type post message", @"message",
@"Hyperlink to your post", @"link",
@"Add description", @"description",
@"Image url string", @"picture",
nil];
FBRequest *requestToPost = [[FBRequest alloc] initWithSession:nil
graphPath:@"/me/feed"
parameters:params
HTTPMethod:@"POST"];
FBRequestConnection *requestToPostConnection = [[FBRequestConnection alloc] init];
[requestToPostConnection addRequest:requestToPost completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
if (!error) {
NSLog(@" %@", result);
}
else
{
NSLog(@"%@", error);
}
}];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.