YYModel
YYModel copied to clipboard
High performance model framework for iOS/OSX.
`- (instancetype)initWithMethod:(Method)method { if (!method) return nil; self = [super init]; _method = method; _sel = method_getName(method); _imp = method_getImplementation(method); const char *name = sel_getName(_sel); if (name) { _name =...
1. 首先把JSON转Model,转换正常。有自定义属性映射如下: ``` + (NSDictionary *)modelCustomPropertyMapper { return @{@"name": @"uid"}; } ``` 2. 然后再把这个转换后的model转换成JSON字符串、或者字典,都会丢失name字段。或者说,name字段名变成了uid。**model中没有定义uid这个属性** 🤣 其他属性映射也有类似问题,如`@{@"desc": @"detail.desc"};`,此时model再转JSON,desc也丢失了。 应该跟作者用到的缓存策略有关系,待研究...
test
Hello bireme, Here is the reason why this pull request happened. I have a model like this: ``` @interface HWPerson : NSObject @property (nonatomic, copy) NSString *firstName; @property (nonatomic, copy)...
后台传过来的数组里是int。 想解析出来数组里都是字符串。好像不支持啊,不知道大家有没有方便的方式
arry[ id : 1, name : wangzi dataArry[ object[0], object[1] ] ] 类似这样的数据结构,最外一层是数组,每个数组里面包含一层字典加数组的结构。在最外层数组模型里面用modelCustomClassForDictionary返回class返回的是当个模型,不能返回里面包含的数组模型。
后台返回的JSON中,在键中的末尾发现有空格,YYModel没有把这个空格去掉,解析失败
我先是使用字典转模型,中间因为模型中的属性名和JSON中的key不一致,进行转化。拿到模型后,再把模型转字典,这时候发现得到的字典里面的属性名变成JSON中的key而不是我模型中正确的属性名。通过断点,发现问题出现在: `- (id)yy_modelToJSONObject { /* Apple said: The top level object is an NSArray or NSDictionary. All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull. All dictionary keys...
`yy_modelHash` 实现中,直接将所有字段 `hash` 相异或 假如说我有这样一个类 ``` @interface Test: NSObject @property (nonatomic, assign) BOOL a; @property (nonatomic, assign) BOOL b; @end ``` 在 `yy_modelHash` 的实现中会导致 `ab` 同为 `YES` 和 `ab`同为 `NO`...
我们现在的json数据里面有thread的和postlist的,postlist是数组,我创建了两个model。但有些字段是thread里面才有的需要传递到postlist里面去,可以怎样做才行呢?