今天遇見實現一個網絡請求接口的遇到一個問題:
@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