您的位置:首页 > 运维架构

BUG-Auto property synthesis will not synthesize property 'description' because it is 'readwrite'

2016-07-25 16:41 531 查看
今天遇见实现一个网络请求接口的遇到一个问题:

@property (nonatomic,
strong)NSString * description;   
//O 描述:最长256字节
报错:

Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it will be synthesized 'readonly' via another property

看了一下才知道,是接口那边定义的字段有问题,做开发的都知道,在代码中有许多特殊字段是不能随便使用的,系统会给你warning提示,

恰好这个descripton就跟系统字典重合了,so 百度了一下,

原因:
是因为 compiler 读取 sub-class 時,会发现 description 明明应该是個 readonly property(super-class 讲的),但你却要将它设为 readwriteproperty,所以 compiler 不知道该怎么 auto synthesis。

解决方法:

#import "AddPrivacyRecord.h"
@implementation AddPrivacyRecord
@dynamic description;

.m文件中 @dynamic一下就OK了哦。

参考的blog:http://blog.csdn.net/l863784757/article/details/46374939
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: