JSONModel

如果有一个数组,且数组里包含的是自定义的对象类型,则一定要在该类前实现名为所包含对象类型的协议,且NSArray 括号内没有 ‘ * ’

@protocol XXImage
@end

@protocol XXPicture
@end

@interface XXModel : JSONModel

@property (nonatomic, copy)  NSString *id;
@property (nonatomic, copy)  NSString *name;
@property (nonatomic, copy)  NSString *address;

@property (nonatomic, strong) NSArray *images;
@property (nonatomic, strong) NSArray *pictures;

@end

给所有property加,在该类的.m里添加如下代码:

+ (BOOL)propertyIsOptional:(NSString *)propertyName{
    return  YES;
}

别的没什么好说的了

你可能感兴趣的:(JSONModel)