iOS工程的警告修复

栏目: C · 发布时间: 8年前

内容简介:iOS工程的警告修复

在项目中碰到300+的警告,强迫症只能修复了

1:#warning这个后面添加中文的话,在xcode的左边警告列表页会显示不全,所以推荐使用英文注释

iOS工程的警告修复

2: (Method possibly missing a [super awakeFromNib] call) 这个处理,1:手动添加2:假如这个方法里面没有代码也可以删除这个方法

iOS工程的警告修复

3: (Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned long')) 这个是重写系统的方法时把枚举类型的返回值写成了NSUInteger,返回值类型改回枚举就好。

4: (“View Controller“ is unreachable because it has no entry points, and no identifier for runtime access via -[UIStoryboard instantiateViewControllerWithIdentifier:].) 这个警告是在一个xib中有多个storyboard其中有Storyboard ID为空的storyboard,找到删除。

5: (Automatic Preferred Max Layout Width before iOS 8.0) 这个警告是因为xib中的label控件Preferred Width属性没有设置,勾选Explicit填上0就好。

iOS工程的警告修复

6: (Frame for "Statuslabel" will be different at run time.) 这个在xcode左边警告列表点击这个警告,会自动跳转到对应的xib,点击图上的按钮,然后Update Frames就好

iOS工程的警告修复

7: (Prototype collection view cells must have reuse identifiers) 这个是因为storyboard中拖入了collectionView,自带的collectionViewCell的reuse identifier为空,填入对应的reuse identifier就行

8: (warning: Attribute Unavailable: First baseline layout attribute before iOS 8.0) 点击对应的警告跳转到xib界面在左边的filter中输入first,搜索出来的约束的firstItem和secondItem的constraint把两个都改为center.Y就好了

9:在podfile文件中 增加"inhibit_all_warnings!"这样pod的工程不会显示任何警告。

10:(PerformSelector may cause a leak because its selector is unknown)

iOS工程的警告修复

加入这个宏:#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

11:('dismissModalViewControllerAnimated:' is deprecated: first deprecated in iOS 6.0)

iOS工程的警告修复

加入这个宏:#pragma clang diagnostic ignored"-Wdeprecated"

12: ( Comparison of constant 'NSStreamEventErrorOccurred' (8) with expression of type 'NSStreamStatus' (aka 'enum NSStreamStatus') is always false)

加入这个宏:#pragma clang diagnostic ignored"-Wtautological-compare"

13: ( Null passed to a callee that requires a non-null argument)

iOS工程的警告修复

加入这个宏:#pragma clang diagnostic ignored"-Wnonnull"

14:(Undeclared selector 'DWJQkeyboardWillShow:')

iOS工程的警告修复

加入这个宏:#pragma clang diagnostic ignored"-Wundeclared-selector"

15:(Logical not is only applied to the left hand side of this comparison)

加入这个宏:#pragma clang diagnostic ignored"-Wlogical-not-parentheses"

16:(Auto property synthesis will not synthesize property 'superColor'; it will be implemented by its superclass, use @dynamic to acknowledge intention)

iOS工程的警告修复

加入这个宏:#pragma clang diagnostic ignored"-Wobjc-property-synthesis"

17:('sizeWithFont:forWidth:lineBreakMode:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:)

iOS工程的警告修复

加入这个宏:#pragma clang diagnostic ignored "-Wdeprecated-declarations"

18:(Unsequenced modification and access to 't')

加入这个宏:#pragma clang diagnostic ignored "-Wunsequenced"

19:(Implicit conversion loses integer precision: 'long' to 'int')

加入这个宏:#pragma clang diagnostic ignored"-Wshorten-64-to-32"

20:(Add explicit braces to avoid dangling else)

加入这个宏:#pragma clang diagnostic ignored"-Wdangling-else"

21:(Unused function 'free_linkedlist')

iOS工程的警告修复

加入这个宏:#pragma clang diagnostic ignored"-Wunused-function"

附上一个查找警告和宏关系的链接: http://fuckingclangwarnings.com


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

数码人类学

数码人类学

[英]丹尼尔·米勒、希瑟·A.霍斯特 / 王心远 / 人民出版社 / 2014-10 / 48.00元

人类学有两大任务,一是理解什么是人,二是理解人性是如何透过多元的文化表现出来。数码科技的蓬勃发展给这两者都带来了新的作用力。《数码人类学》向读者展示了人类与数码科技如何辩证地相互定义。最终我们试图得出一个结论,那便是“数码科技对人类到底意味着什么?” 从社交网站到数字化博物馆;从数字时代政治学到电子商务,浸润式的数码科技,给普通人的生活带来了根本性的改变。仅仅用数据来说明与理解问题显然过于太......一起来看看 《数码人类学》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

SHA 加密
SHA 加密

SHA 加密工具