我是靠谱客的博主 魁梧水池,这篇文章主要介绍non-ARC代码转 ARC 排除 “Existing instance variable 'delegate' for property with assign attribute must be ...,现在分享给大家,希望可以做个参考。
原来非ARC代码是
复制代码
1
2
3
4
5
6
7
8
9
10@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
应改为
复制代码
1
2
3
4
5
6
7
8
9
10@interface MHWebImageDownloader : NSObject { _weak id<MHWebImageDownloaderDelegate> delegate; } . . . @property (nonatomic, weak) id<MHWebImageDownloaderDelegate> delegate;
转载于:https://www.cnblogs.com/guozai9527/p/4028932.html
最后
以上就是魁梧水池最近收集整理的关于non-ARC代码转 ARC 排除 “Existing instance variable 'delegate' for property with assign attribute must be ...的全部内容,更多相关non-ARC代码转内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复