iOS Facebook Api,点赞评论帖子
<p><p>我想在 Facebook 上对帖子发表评论,我使用与喜欢帖子相同的方式。点赞帖子有效,点赞评论失败。</p>
<p><strong>文档</strong>:
<a href="https://developers.facebook.com/docs/graph-api/reference/object/likes" rel="noreferrer noopener nofollow">https://developers.facebook.com/docs/graph-api/reference/object/likes</a> </p>
<p><strong>我的代码</strong>:</p>
<pre><code>
parameters:nil
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{//Error:
}];
</code></pre>
<p><strong>错误是</strong>:</p>
<blockquote>
<p>Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x158999b0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 100;
message = "(#100) Error finding the requested story";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=}</p>
</blockquote></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>这就是我的做法,它就像一个魅力</p>
<pre><code> // post is my module object, encapsulates the info form the post
// pass the post ID
NSString *graphPath = ;
FBRequest *request = ;
// DELETE or POST the like
NSString *method = post.liked?@"DELETE":@"POST";
;
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
BOOL success = YES;
success = (error)?NO:YES;
if(success) {
}
}];
</code></pre>
<p>注意:确保您有发布权限</p></p>
<p style="font-size: 20px;">关于iOS Facebook Api,点赞评论帖子,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/22665281/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/22665281/
</a>
</p>
页:
[1]