我希望拉入我最近的签到,以及找到地名。我目前要求user_status权限。我首先请求这样的数据:
-(void) makeCheckinRequest{
NSString *query =
@"{"
@"'checkins':'SELECT coords, page_id, timestamp FROM checkin WHERE author_uid= me()',"
@"'places':'SELECT name FROM place WHERE page_id IN (SELECT page_id FROM #checkins)',"
@"}";
NSDictionary *queryParam =
[NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
[self extractRelevantRecentCheckinsFor:result];
NSLog(@"Result: %@", result);
}
}];
}
...然后我拦截了这个方法返回的数据:
-(void) extractRelevantRecentCheckinsFor:(id) graphObject{
NSDictionary *resultDict = (NSDictionary *)graphObject;
NSArray *data = [resultDict objectForKey:@"data"];
for (FBGraphObject *friendObj in data) {
NSDate *date = [NSDate dateWithTimeIntervalSince1970:
[[friendObj objectForKey:@"timestamp"] intValue]];
DLog(@"checkin date is %@", [[theStoryline.common dayAndTime] stringFromDate:date]);
}
}
问题是data
包含两个FBGraphObjects
,其中包含不匹配的项目数。密钥名称为FBGraphObject
的{{1}}有15个对象,所有对象都有有效坐标。
密钥名称为checkins
的{{1}}有14个对象。
你怎么可能得到不同的数组大小?
答案 0 :(得分:1)
找到答案:事实证明,Facebook会在每次办理登机手续时向您返回“登记入住”清单,但是(至少我写了多次查询的方式)它会返回独特的“地方”列表。这意味着我曾两次检查过一个地方。