我正在使用 FQL 来确定用户是否喜欢某个帖子。当用户没有喜欢任何帖子时,响应已经足够好,但是当帖子被点赞时它保持不变,我没有得到用户(我的)user_id
的响应。
这是我所做的:(在获得read_stream
许可后在授予的块内)
NSURL *requestURL = [NSURL URLWithString:@"https://graph.facebook.com/fql"];
NSMutableDictionary * params = [NSMutableDictionary
dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"select user_id from like where object_id=%@ AND user_id=me()",postID], @"q", nil];
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:requestURL
parameters:params];
request.account = [[self.accountStore accountsWithAccountType:accountTypeFacebook] objectAtIndex:0];
[request performRequestWithHandler:^(NSData *data,
NSHTTPURLResponse *response,
NSError *error) {
if(!error){
NSDictionary *resultDictionary = [[NSDictionary alloc] init];
resultDictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSLog(@"dictionary with user id's: %@",resultDictionary);
}else{
//handle error gracefully
}
}];
输出(不喜欢帖子时):
{
data = (
);
}
输出(当帖子被喜欢时):
{
data = (
);
}
我尝试使用post_id
inplace of传递帖子的 id 和查询object_id
,但没有成功。