我正在尝试使用iOS中的图形API(page_id / photos)和Objective-C上传Facebook页面墙上的帖子,但在看到Facebook页面的响应后,我的帖子将显示在访问者帖子而不是Facebook页面壁。我尝试传递页面访问令牌广告参数并提供manage_pages,publish_pages和publish_action,但仍在帖子中显示帖子。请帮帮我。
这是我的代码:
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/me/accounts" parameters:@{@"fields":@"id,name,access_token"}
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
NSLog(@"%@",result);
NSArray *data = [result valueForKey:@"data"];
NSArray *fbPageAT = [data valueForKey:@"access_token"];
NSURL *postImgURL = [NSURL URLWithString:upload_file];
NSDictionary *params = @{
@"caption": _createPostTextField.text,
@"url": postImgURL,
@"access_token": [fbPageAT objectAtIndex:selectedIndex],
};
FBSDKGraphRequest *r = [[FBSDKGraphRequest alloc]
initWithGraphPath:[NSString stringWithFormat:@"/%@/photos",fbPageIDToPost]
parameters:params
HTTPMethod:@"POST"];
[r startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
NSLog(@"%@", result);
}];
}];