是否有人尝试使用新的Facebook SDK向网址发布评论?我尝试使用这样的startForPostWithGraphPath(从Scrumptious项目中挑选的代码片段):
id action = [FBGraphObject graphObject];
[action setValue:@"test from iOS app" forKey:@"message"];
// Create the request and post the action to my url path.
[FBRequestConnection startForPostWithGraphPath:@"XXXXXXXXXXXXXXXXXXX/comments"
graphObject:action
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error)
{
NSLog(@"error: %@", error.localizedDescription);
}
else
{
NSLog(@"ok!!");
}
}];
它在Open Graph API资源管理器中都不起作用。我收到的错误是“发生了未知错误”,代码200.XXXXXXXX网址是我评论的网页的ID,我可以阅读它们,但没有正确发布给他们。也许开放的图形路径是错误的?
答案 0 :(得分:1)
我在IOS中发布评论和喜欢GraphAPI
请在下面写下一些代码。
NSMutableDictionary *res = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"This is my comment", @"message", @"Your api's access Token",@"access_token",nil];
[FBRequestConnection startWithGraphPath:@"XXXXXXXXXX/comments" parameters:res HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error)
{
NSLog(@"error: %@", error.localizedDescription);
}
else
{
NSLog(@"ok!!");
}
}];
XXXXXXXXXX = Id where you want to comment.
注意: -
Please do not appent https://graph.facebook.com
之前
XXXXXXXXXX/comments