2

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

Community
  • 1
  • 1
Ryasoh
  • 173
  • 1
  • 1
  • 10
  • The key in JSON data for images is "photo" and you are using "photos" so it will return you null. And also give size in the final image url as mentioned in "Foursquare API for venue user image error" answer. – Yuvrajsinh Nov 14 '14 at 05:26
  • I've tried "photo" and also 'ann.photo = v[@"photo"][@"prefix"];', but when I nslog it's null still. – Ryasoh Nov 14 '14 at 14:35

1 Answers1

1

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

Aamir
  • 16,329
  • 10
  • 59
  • 65