Nasted Array mapping restkit v.20

Я хочу нанести на карту объект в Google Places Api Photos

  "photos" : [
            {
               "height" : 1224,
               "html_attributions" : [
                  "\u003ca href=\"https://plus.google.com/105663944571530352563\"\u003eJoshua Gilmore\u003c/a\u003e"
               ],
               "photo_reference" : "CnRoAAAAzuH4E1LVJHMdXNYbewoxcPE-qHizCE6pmOGjckeaCTKSL7xGVzLuwGxu7kx44bCWIZinMx4jkd8eenALB7w7jNRFrzE3hip2ld7096SI9D4sE2WpXQ1QH-iTQm7qhx4i6QSGGeXKjA9SfT4N6krwzRIQr1mulgyuKHP-2s_TJWIahhoUgxfccds3VAH2bj_CIQYzbAQZRhc",
               "width" : 1632
            }
         ],

я пытаюсь с этим кодом, но фотографии все еще ноль

Класс места

@interface Place : NSObject    
@property (nonatomic,strong) Geometry * geometry;
@property (nonatomic,strong) NSString * icon;
@property (nonatomic,strong) NSString * placeID;
@property (nonatomic,strong) NSString * name;
@property (nonatomic,strong) OpeningHours * opening_hours;
@property (nonatomic,strong) NSString * price_level;
@property (nonatomic,strong) NSString * rating;
@property (nonatomic,strong) NSString * vicinity;
@property (nonatomic,strong) NSArray *photos;
@property (nonatomic,strong) NSString *reference; 
@end

Фотографии класса

#import <Foundation/Foundation.h>
@interface Photos : NSObject
@property (nonatomic,strong) NSNumber *height;
@property (nonatomic,strong) NSString *html_attributions;
@property (nonatomic,strong) NSString *photo_reference;
@property (nonatomic,strong) NSNumber *width;
@end

И я сопоставляю с:

 RKObjectMapping *placeMapping = [RKObjectMapping mappingForClass:[Place class]];
    [placeMapping addAttributeMappingsFromDictionary:@{
     @"icon" : @"icon",
     @"id" : @"placeID",
     @"name" : @"name",
     @"reference" : @"reference",
     @"price_level" : @"price_level",
     @"rating" : @"rating",
     @"vicinity" : @"vicinity",
     }];



RKObjectMapping* photosMapping = [RKObjectMapping mappingForClass:[Photos class]];
    [photosMapping addAttributeMappingsFromArray:@[@"height",@"photo_reference",@"html_attributions",@"width"]];

    [placeMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"photos"
                                                                                 toKeyPath:@"photos"
                                                                               withMapping:photosMapping]];

Я не знаю, как отобразить фотографии как массив в Place Class . Кто-нибудь может мне помочь?

0 ответов

Другие вопросы по тегам