0
我正在使用FQL來確定用戶是否喜歡發佈。當用戶不喜歡任何帖子時,回覆是足夠好的,但是當帖子被喜歡時它仍然是一樣的,我沒有得到用戶的(我的)user_id
作爲迴應。Facebook Graph API/FQL來檢查用戶是否喜歡發佈
這裏就是我所做的:(授予塊內得到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 = (
);
}
輸出(如果POST喜歡):
{
data = (
);
}
我試着通過帖子的id和在查詢中使用post_id
我object_id
,但沒有成功。