xcode编译后警告的解决方法
2019-03-06 本文已影响0人
Mr_Coder
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警告就会消失
![](https://img.haomeiwen.com/i2927308/f3a119451c44d46a.png)
3、Block implicitly retains 'self'; explicitly mention 'self' to indicate this...
在Build Setting里面搜索Implicit retain of 'self' within blocks里面从YES设置为NO即可![](https://img.haomeiwen.com/i2927308/f2ad1fa1dd2b84ca.png)