问题描述
有没有人试图使用新的Facebook SDK向网址发表评论?我尝试使用像这样的startForPostWithGraphPath(从Scrumptious项目中选择的代码段): id action = [FBGraphObject graphObject];
[action setValue:@从iOS应用程序测试forKey:@message];
//创建请求并将操作发布到我的URL路径。
[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 url是我有评论的页面的ID,我可以阅读他们,但没有正确发布他们。也许开放图路径是错误的?
朋友这是一个好消息。
我在IOS中发布了GraphAPI的评论和喜欢
只需在下面写下一些代码。
NSMutableDictionary * res = [NSMutableDictionary dictionaryWithObjectsAndKeys:@这是我的评论,@message,@你的api的访问令牌,@access_token,nil];
[FBRequestConnection startWithGraphPath:@XXXXXXXXXX / comments参数:res HTTPMethod:@POSTcompletionHandler:^(FBRequestConnection * connection,id result,NSError * error){
if(error)
{
NSLog(@error:%@,error.localizedDescription);
}
else
{
NSLog(@ok !!);
}
}];
XXXXXXXXXX = Id要评论的位置。
注意: -
请不要附加https://graph.facebook.com
before
XXXXXXXXXX /评论
Has anyone tried to use the new Facebook SDK to post a comment to an URL? i tried by using startForPostWithGraphPath like this (code snippet picked from Scrumptious project):
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!!");
}
}];
it doesn't work neither from Open Graph API explorer. The error i receive is "an unknown error has occurred", code 200. The XXXXXXXX url is the ID of the page i have comments on, i can read them, but not correctly post to them. Maybe the open graph path is wrong?
Hey Friend It's a Good News for you.
I Post the comments and Likes with GraphAPI in IOS
Just write Some code below.
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.
Note:-
Please do not appent https://graph.facebook.com
before
XXXXXXXXXX/comments
这篇关于Facebook iOS SDK 3.0:如何对现有网址发表评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!