内容简介:iOS工程的警告修复
在项目中碰到300+的警告,强迫症只能修复了
1:#warning这个后面添加中文的话,在xcode的左边警告列表页会显示不全,所以推荐使用英文注释
2: (Method possibly missing a [super awakeFromNib] call) 这个处理,1:手动添加2:假如这个方法里面没有代码也可以删除这个方法
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就好。
6: (Frame for "Statuslabel" will be different at run time.) 这个在xcode左边警告列表点击这个警告,会自动跳转到对应的xib,点击图上的按钮,然后Update Frames就好
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)
加入这个宏:#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
11:('dismissModalViewControllerAnimated:' is deprecated: first deprecated in iOS 6.0)
加入这个宏:#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)
加入这个宏:#pragma clang diagnostic ignored"-Wnonnull"
14:(Undeclared selector 'DWJQkeyboardWillShow:')
加入这个宏:#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)
加入这个宏:#pragma clang diagnostic ignored"-Wobjc-property-synthesis"
17:('sizeWithFont:forWidth:lineBreakMode:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:)
加入这个宏:#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')
加入这个宏:#pragma clang diagnostic ignored"-Wunused-function"
附上一个查找警告和宏关系的链接: http://fuckingclangwarnings.com
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Rust 1.29 发布,支持自动修复警告代码
- [图]CISA再发安全警告:推荐Windows用户尽快修复BlueKeep漏洞
- 光之翼 Java 通用代码生成器 1.0.0 Beta 2 版已公布,修复编译错和编译警告,所有示例通过测试
- BUF早餐铺 | Git中的远程代码执行漏洞已被修复,多个工具受影响;美国国土安全部警告称网络安全将...
- c – 我可以在不禁用“将警告视为错误”的情况下排除某些特定警告吗?
- PHP警告:除以零
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Head First Rails
David Griffiths / O'Reilly Media / 2008-12-30 / USD 49.99
Figure its about time that you hop on the Ruby on Rails bandwagon? You've heard that it'll increase your productivity exponentially, and allow you to created full fledged web applications with minimal......一起来看看 《Head First Rails》 这本书的介绍吧!