美文网首页iOS
xcode编译后警告的解决方法

xcode编译后警告的解决方法

作者: Mr_Coder | 来源:发表于2019-03-06 16:11 被阅读0次
    1、忽略cocoapods引入第三方中的警告

    pod 'Masonry', '~> 1.1.0', :inhibit_warnings => true
    或者在Podfile文件中增加一句inhibit_all_warnings!
    注:添加后编译失效,还要在终端执行 pod install 命令才行

    2、This block declaration is not a prototype

    我们定义一个不带参数的block,通常是如下的方式:
    typedefvoid (^TestBlock)(); 会提示一个警告,This block declaration is not a prototype;
    解决方式如下的几种:
    I、typedefvoid (^TestBlock)(void);
    II、

    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wstrict-prototypes"
    typedefvoid (^TestBlock)();
    #pragma clang diagnostic pop
    
    III、彻底解决这种警告,在工程中搜索Strict Prototypes 设置为NO警告就会消失 111.png
    3、Block implicitly retains 'self'; explicitly mention 'self' to indicate this...
    在Build Setting里面搜索Implicit retain of 'self' within blocks里面从YES设置为NO即可 屏幕快照 2019-03-06 11.59.33.png

    相关文章

      网友评论

        本文标题:xcode编译后警告的解决方法

        本文链接:https://www.haomeiwen.com/subject/eafxpqtx.html