因此,这是我的 FQL 查询,用于检索用户事件的场所:
NSString* fql1 = [NSString stringWithFormat:
@"SELECT venue from event WHERE eid in (SELECT eid FROM event_member WHERE uid = me())"];
NSString* fql2 = [NSString stringWithFormat:
@"SELECT name FROM page WHERE page_id IN (SELECT venue.id FROM #event_info)"];
NSString* fqlStr = [NSString stringWithFormat:
@"{\"event_info\":\"%@\",\"event_venue\":\"%@\"}",fql1,fql2];
NSDictionary* params = [NSDictionary dictionaryWithObject:fqlStr forKey:@"queries"];
FBRequest *fql = [FBRequest requestWithGraphPath:@"fql.query" parameters:params HTTPMethod:@"POST"];
[fql startWithCompletionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (result) {
NSLog(@"result:%@", result);
}
if (error) {
NSLog(@"error:%@", error);
}
}];
查询本身很好,我在 Graph API Explorer 中尝试过。但我收到了这个错误:
error:Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x1f01da20 {com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 240;
message = "(#240) Requires a valid user to be specified (either via the session or via the API parameter for specifying the user.";
type = OAuthException;
};
};
code = 403;
}, com.facebook.sdk:ErrorSessionKey=<PFReceptionist: 0xb2426b0>}
我究竟做错了什么?这不是我对会话的第一次查询,我已经要求 user_events 权限和简单的非 FQL 事件查询工作正常。