所以我试图从 iPhone 应用程序在我的 Facebook 页面(我是管理员)上发布照片。我正在使用 FB Sessions 创建会话,获取读取权限,获取管理页面权限,然后,我成功获取我的 Facebook 页面应用程序 ID,因为
[FBRequestConnection startWithGraphPath:@"/me/accounts" completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
NSLog(@"%@", [result description]);
}]; // have token, what now?
这仍然很好。然后,我尝试将照片发布到 app_id/photos feed,但它不起作用 = 它正确上传照片,但显示我(如我的个人资料中)上传照片而不是页面本身。可能是什么问题呢?
这是参数和调用的代码
NSDictionary *params = [NSDictionary
dictionaryWithObjects: [NSArray arrayWithObjects:
[UIImage imageNamed:@"Icon.png"],
@"This is my first photo post from xcode app", nil]
forKeys:[NSArray arrayWithObjects:
@"source",
@"message", nil]];
[FBRequestConnection startWithGraphPath:@"MyPageID/photos" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
NSLog(@"%@", [result description]);
} ];
the [result description]
调用的日志很好(它返回 id = xx 和“post_id”= yy,我认为这是正确的),调用本身也是如此 - 唯一的问题是它显示我作为作者,而不是页面本身。
MyPageID 是正确的,因为调用
NSDictionary *paramsFeed = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"This is my first page post from xcode app", nil] forKeys:[NSArray arrayWithObjects:@"message", nil]];
[FBRequestConnection startWithGraphPath:@"390106241058188/feed" parameters:paramsFeed HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
NSLog(@"result: %@", [result description]);
}];
另外,打电话me/photos
并用字典键@“图片”将照片发布到那里,效果很好,并且它完美地将照片发布在我自己的墙上。
有谁知道问题可能隐藏在哪里?