YYModel icon indicating copy to clipboard operation
YYModel copied to clipboard

`- [NSObject(YYModel) yy_modelToJSONObject]` 方法不支持 CGRect 和 NSValue

Open heistings opened this issue 7 years ago • 1 comments

This is my model class:

@interface YYWebArticle : YYArticle

@property (nonatomic, strong) NSString *url;
@property (nonatomic) CGRect rect;
@property (nonatomic) NSValue *myRect;

@end
@implementation YYWebArticle

+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper
{
    NSMutableDictionary *mapper = [[super modelCustomPropertyMapper] mutableCopy];
    
    [mapper addEntriesFromDictionary:@{
                                       @"url":@"url",
                                       @"myRect":@"rect"
                                       }];
    
    return [mapper copy];
}

@end

The - [NSObjee.ct(YYModel) yy_modelToJSONObject] does not work for me:

(lldb) po article.url

http:www.weibo.cn/adffsffasff

(lldb) po article.myRect

NSRect: {{100, 100}, {100, 100}}

(lldb) po [article yy_modelToJSONObject]

{

​ url = "http:www.weibo.cn/adffsffasff";

}

heistings avatar Jan 25 '18 14:01 heistings

This bug can be fixed by #268

heistings avatar Jan 26 '18 07:01 heistings