non-ARC代码转 ARC 排除 “Existing instance variable 'delegate' for property with assign attribute must be _unsafe _unretained” 错误
原来非ARC代码是
@interface MHWebImageDownloader : NSObject { id<MHWebImageDownloaderDelegate> delegate; } . . . @property (nonatomic, weak) id<MHWebImageDownloaderDelegate> delegate;
变为 ARC 该代码报错,Existing instance variable 'delegate' for property with assign attribute must be _unsafe _unretained
根据Stack Overflow上这篇帖子
http://stackoverflow.com/questions/7021852/arc-error-when-declaring-delegate-ivar
应改为
@interface MHWebImageDownloader : NSObject { _weak id<MHWebImageDownloaderDelegate> delegate; } . . . @property (nonatomic, weak) id<MHWebImageDownloaderDelegate> delegate;