Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it
来源:互联网 发布:软件开发挣钱吗 编辑:程序博客网 时间:2024/06/07 03:50
解析后台返回的json数据时,推荐使用MJExtension ,使用起来很方便
github:https://github.com/CoderMJLee/MJExtension
在AModel.h中
@property(nonatomic,strong)NSString *description;
出现提示warning:Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it will be synthesized 'readonly' via another property
原因是因为 compiler 读取 sub-class 時,会发现 description 明明应该是個 readonly property(super-class 讲的),但你却要将它设为 readwriteproperty,所以 compiler 不知道该怎么 auto synthesis。
解决办法:
AModel.m
@implementation AModel
@dynamic description;
@end
但是刚从后台拿数据时,用MJExtension.h解析数据时,还是拿不到数据。
后台返回的字典里的字段是description,但是可以在model里用Description来表示,大写的D。
在AModel.m里实现
+(NSDictionary *)replacedKeyFromPropertyName{
return@{@"Description":@"description"};
}
核心代码:
AModel *subM = [AModelobjectWithKeyValues:dic];
- Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it
- Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it
- Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it
- BUG-Auto property synthesis will not synthesize property 'description' because it is 'readwrite'
- Auto property synthesis will not synthesize property …because it is ‘readwrite’ but it will be synth
- [iOS开发]错误总结一:Auto property synthesis will not synthesize property 'imageView' because it is 'readwri
- Auto property synthesis will not synthesize property 'delegate'; it will be implemented by its super
- Auto property synthesis will not synthesize property ‘delegate’;it will be implemented by its superc
- Auto property synthesis will not synthesize property ‘delegate’;it will be implemented by its superc
- Auto property synthesis will not synthesize property......
- Auto property synthesis will not synthesize property '***'
- auto property synthesis will not synthesize proterty ;it will be implementedby its superclass, use @
- 报错原因:Auto property synthesis will not synthesize property 'title'; it will be implemented by its sup
- AFNetwork错误:Auto property synthesis will not synthesize property
- Xcode: Auto property synthesis will not synthesize property 解决
- Auto property synthesis will not synthesizeproterty;it will be implemented by its superclass, use@dy
- Xcode升级了6.3 出现的警告:Auto property synthesis will not synthesize property
- OC 中 覆盖属性会有提示Auto property synthesis will not synthesize property 'delegate'
- 欧拉路 小结(POJ 2337 为例子)
- 利用aapt工具获取apk信息
- 第三章第43题
- iPhone:动态获取UILabel的高度和宽度
- maven3常用命令
- Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it
- Openwrt 移植hello world
- 开源集合-最火的Android开源项目(二)
- C++生成54个不同的随机数
- Hadoop问题汇总
- Odoo(OpenERP)应用实践:办公用品的领用及归还
- JSONObject和JSONArray的区别
- Gerrit服务器的搭建(Git+Gerrit+PostgreSQL+LDAP)
- 跳槽要遵守的11条守则