Foursquare venues "photos" request return null

442 Views Asked by At

I'm using FourSquare API based on Constantine's code (https://github.com/Constantine-Fry/Foursquare-API-v2). In my venue object I'm able to call name and id, but when i call 'photos' it returns null. I've tried including prefix and/or suffix after it also but it doesn't return.

In my venue object I have:

- (NSArray *)convertToObjects:(NSArray *)venues {
    NSMutableArray *objects = [NSMutableArray arrayWithCapacity:venues.count];
    for (NSDictionary *v  in venues) {
        FSVenue *ann = [[FSVenue alloc]init];
        ann.name = v[@"name"];
        ann.venueId = v[@"id"];
        ann.photo = v[@"photos"];
        [objects addObject:ann];
    }
    return objects;
}

When I print venues Array I get:

           gender = none;
            homeCity = "Knoxville, TN";
            id = 12864010;
            photo =                     {
                prefix = "https://irs0.4sqi.net/img/user/";
                suffix = "/DMGZGZVXT3NVLKNP.jpg";
            };

I see it's photo but not photos and have tried both. How can I retrieve the prefix and suffix strings? My intent will be to add size between the two based on this response: Foursquare API for venue user image error

1

There are 1 best solutions below

0
On

Pieces needed to construct category icons at various sizes. Combine prefix with a size (32, 44, 64, and 88 are available) and suffix, e.g.
https://foursquare.com/img/categories/food/default_64.png.

To get an image with a gray background, use bg_ before the size, e.g. https://foursquare.com/img/categories_v2/food/icecream_bg_32.png.

{
  icon = {
           prefix = "https://ss3.4sqi.net/img/categories_v2/travel/airport_gate_";
           suffix = ".png";
          };
}

Above image url can be formed as

https://ss3.4sqi.net/img/categories_v2/travel/airport_gate_64.png

Source: https://developer.foursquare.com/docs/responses/category