Objective-c 编译问题

这个日志用来记录xcode 编译期间遇见的warning or错误 ,会持续更新哒~ 如果我还在...

1. Implicit conversion loses integer precision: 'long' to 'int'

int是32bit,long是64bit,转换的时候会有精度问题, 要么修改格式强转 要么消除隐藏这个警告。

首先通过reveal log检查warning类型,在log中可以看到:warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] key值设为:-Wno-shorten-64-to-32

在Build Setting 里面搜索Other Warning Flags 添加-Wno-shorten-64-to-32即可隐藏warning.

或者是,如下图,Build Phase中找到对应出现warning的文件 ,添加进去一样可以。

2. Empty paragraph passed to '@param' command

xcode升级之后,第三方库中之前旧的注解方式不符合要求,所以会出现一大堆warning.

可以在编译的时候消除隐藏这些警告。同上面的方式一样。

在Build Setting 里面搜索Other Warning Flags 添加-Wno-documentation即可

3. Auto Layout Localization: Views without any layout constraints may clip their content or overlap other views.

View的控件没有添加约束,可能对view 其他控件内容造成影响,一般来说可以不用管的,不过严格来说,是应该做layout 约束。
storyboard 提供View界面约束布局功能,比较方便。

4. Auto property synthesis will not synthesize property ‘xxxxx’; it will be implemented by its superclass, use @dynamic to acknowledge intention

说明:这是说编译器自动给属性合成getter和setter的时候将会在它的父类上实现,用@dynamic告诉编译器这个属性是动态的,动态的意思是等你编译的时候就知道了它只在本类合成。

解决方法:在.m文件@implementation下面加一行@dynamic PROPERTY;即可。

Knowledge, like candlelight, can illuminate a person and countless people.
原文地址:https://www.cnblogs.com/xiaoqiangink/p/14334892.html