Question

I am looking to pull in my recent checkins, as well as find the place name. I currently ask for user_status permissions. I start off by requesting the data like this:

-(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);
                          }
                      }];

}

...then I intercept the data that is returned by this method:

-(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]);
}

}

The problem is that data contains two FBGraphObjects that contain a mismatched count of items. The FBGraphObject with the key name: checkins has 15 objects, all with valid coordinates.

The FBGraphObject with the key name: places has 14 objects.

How could it be possible that you get different array sizes?

Was it helpful?

Solution

Found the answer: As it turns out, Facebook will return to you a list of 'checkins' for each time you've checked in, however (at least the way I have the multi-query written) it will return a unique list of 'places'. What this mean was that I had checked in to one place twice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top