zoukankan      html  css  js  c++  java
  • 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;
  • 相关阅读:
    Java应用程序的运行机制
    IO流——字符流
    IO流——字节流
    Java API --- File类
    SSM框架整合
    Mybatis核心组件
    AJAX 练习
    设计者模式
    软件七大设计原则
    并发编程
  • 原文地址:https://www.cnblogs.com/guozai9527/p/4028932.html
Copyright © 2011-2022 走看看