我正在使用 FQL 多查询获取用户的事件。
NSString *eventQuery1 = @"SELECT name, start_time, end_time, location, description, venue, host, eid, privacy FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = me() AND rsvp_status='attending' )";
NSString *eventQuery2 = @"SELECT name, start_time, end_time, location, description, venue, host, eid, privacy FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = me() AND rsvp_status='maybe' )";
NSString *eventQuery3 = @"SELECT name, start_time, end_time, location, description, venue, host, eid, privacy FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = me() AND rsvp_status='declined' )";
NSString *eventQuery4 = @"SELECT name, start_time, end_time, location, description, venue, host, eid, privacy FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = me() AND rsvp_status='not_replied' )";
NSString* fql = [NSString stringWithFormat:
@"{\"attending\":\"%@\",\"maybe\":\"%@\",\"declined\":\"%@\",\"not_replied\":\"%@\"}",eventQuery1, eventQuery2, eventQuery3, eventQuery4];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObject:fql forKey:@"queries"];
[_facebook requestWithMethodName:@"fql.multiquery" andParams:params andHttpMethod:@"GET" andDelegate:self];
当我收到事件时,我将它们存储到 Core Data。稍后当我需要获取信息(例如事件的图像)时,我使用“eid”来获取事件的图像。但是我注意到那些“eid”字段与 Facebook 图形调用返回的字段不匹配。在图中,我获取事件的 id 并使用它稍后获取事件图像。
"id": "281780925236476",
我的问题是:如何使用 FQL 获取图形 API 返回的唯一事件 ID?或者,我可以使用图形 API 调用来获得与 FQL 查询相同的结果:所有事件(可能使用批处理调用)和所有事件字段。例如,对 /events 的图形 API 查询不返回事件描述。
我正在尝试最小化来自 iOS 应用程序的 HTTP 调用量,并且使用 FQL 查询似乎是一种方式。如果可以实现相同的结果,我更喜欢使用 Graph API。
谢谢