posting comments to facebook results in "user not visible" error
I am writing a facebook app for iphone, however when I send a request to post a comment I get the following error:
failed with error: Error Domain=api.facebook.com Code=210 "User not visible" UserInfo=0x5a986b0 {request_args=(
{
key = text;
value = "Test comment";
},
{
key开发者_Python百科 = format;
value = XML;
},
{
key = "post_id";
value = "100001297086328_132682710102963";
},
{
key = "call_id";
value = 1279912620;
},
{
key = v;
value = "1.0";
},
{
key = "api_key";
value = XXXXXXXXXXXXXXXXXXXXXXX;
},
{
key = method;
value = "facebook.stream.addComment";
},
{
key = "session_key";
value = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
},
{
key = sig;
value = XXXXXXXXXXXXXXXXXXXXXXXXXXX;
}
When I attempt to comment on the same post with the same user and facebook app using the test console at http://developers.facebook.com/docs/reference/rest/stream.addComment it works just fine.
My current permissions are: read_stream, publish_stream, read_friendlists
The code I am using for the request is:
-(void)postComment:(NSString *)comment forPost:(NSString *)postID {
NSLog(@"postComment called");
NSLog(@"comment is: %@", comment);
NSLog(@"post ID is: %@", postID);
currentRequest = @"post comment";
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
comment, @"text",
postID, @"post_id",
nil];
[[FBRequest requestWithDelegate:self] call:@"facebook.stream.addComment" params:params];
}
I can "like" the same post. I have no idea why this isn't working.
Turns out the answer is to update the iOS SDK classes provided by Facebook. The new ones connect via desktop authentification with an access token which lets you use the new graph API to add comments.
The new SDK can be found here: http://github.com/facebook/facebook-ios-sdk/
it will require some changes to current methods, but nothing too complicated.
Check whether 2 users are in friends list of each other...?
It may be possible many time, that you added into cache and polling data from it... which may consist old data and throws this type of error.
精彩评论