【发布时间】:2012-10-16 21:02:49
【问题描述】:
好的,我知道如何在 USER 的墙上发帖(时间线?),效果很好。
我想要的是当用户在他的 iPhone 上做某些事情时,它应该显示为 APP 墙上的帖子。帖子应以 USER 的名义发帖。
类似:
幸运的卢克说:大家好
Zaphod Beeblebrox 开始使用 Awesomeapp
PLUS:只有应用程序的用户才能发布到应用程序的墙上(我看到页面的«管理权限»部分的设置,我可以设置谁可以发布到墙上。我不希望每个人发帖)
如果我是对的,该帖子也会自动出现在用户的供稿中,不是吗?还是我必须在用户的墙上发第二个帖子?
当用户首次使用应用程序时,我请求以下权限:@"user_photos",@"user_videos", @"manage_pages",@"read_stream", @"publish_stream",@"user_checkins",@"friends_checkins" ,@"email",@"user_location"
(最近添加了 read_stream 和 manage_pages,因为我在某处读到了 - 并没有帮助 :)
这是我用来发帖的一段代码:
NSString *graphPath = [NSString stringWithFormat: @"/%@/feed?access_token=%@", FBAppID, [FBAccessToken stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
NSLog(@"graph path %@", graphPath);
NSDictionary *postParams =
@{
@"Test": @"message"
};
[FBRequestConnection
startWithGraphPath:graphPath
parameters:postParams
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"error: domain = %@, code = %d, %@",
error.domain, error.code, error.description);
} else {
NSLog(@"Posted action, id: %@",
[result objectForKey:@"id"]);
}
// Show the result in an alert
}];
返回错误 100(缺少消息或附件 - OAuthException)
我现在用谷歌搜索了两天,找不到任何合适的指导方针......帮助! :)
[编辑] 我可能正在做一些事情......
似乎NSDictionary *postParams @{@"Test": @"message"}; 是问题所在。
当我使用正确的[[NSDictionary alloc] initWithObjectsAndKeys: ...]; 时,它似乎可以工作......我们会看到:)
[编辑] 好的 - 我应该休息一下,看来...
使用@{...} 初始化字典需要先键,然后是对象,而 [NSDictionary dictionaryWithObjectsAndKeys:...] 先设置对象,然后是键...
我现在觉得有点傻……
【问题讨论】:
标签: ios facebook post facebook-wall