ios开发小技巧iOS大咖Xcode报错专区

xcode 警告去除

2017-09-22  本文已影响159人  小明2021

下面列举几种常见的警告(基本可以保证把项目中的警告控制在3个以内):

tip: 在 .pch 引用pod的库的时候最好用 #import <Masonry/Masonry.h> 这样的,如果用 “” 会出现奇怪的警告。

1、警告信息:

warning: no rule to process file '.h' of type sourcecode.c.h for architecture i386
warning: no rule to process file '/User..../ThridFrameworks/WXSTransition/UIViewController+WXSTransitionProperty.h' of type sourcecode.c.h for architecture x86_64
warning: no rule to process file '/Users/..../ThridFrameworks/WXSTransition/WXSPercentDrivenInteractiveTransition.h' of type sourcecode.c.h for architecture x86_64

解决方法:

TargetSettings -> Build Phases -> Compile Sources -> 删掉多余的.h文件
这里面不能有 .h 文件。否则有警告。

2、警告信息:pod里面的警告
解决方法:

隐藏所有pod相关的警告 在pod文件里添加: inhibit_all_warnings 并且在:
Targets --> Build Settings --> Inhibit All Warnings 设置为 YES。
有时候自己的项目里面包含类似 AipOcrSdk.xcodeproj的子项目,子项目也要设置。

pod 相关的警告需要在 pod -- Project 里面添加:
例如:[-Wdocumentation] 需要添加为: -Wno-documentation 自己手动加入 no-


屏幕快照 2017-11-02 上午10.29.13.png
3、警告信息:Empty paragraph passed to '@param' command
解决方法:

在 Targets -- > Build Setting -> Other Warning Flags 添加 "-Wno-documentation"
有时间自己的项目里面包含类似 AipOcrSdk.xcodeproj的子项目所有在子项目的这个位置也需要设置"-Wno-documentation"

4、警告信息:

ld: warning: instance method '_setupImageBubbleConstraints' in category from /Users//Library/Developer/Xcode/DerivedData/niaoyutong-dfkbsdyldkxahudgkltbsgstbnte/Build/Intermediates.noindex/niaoyutong.build/Debug-iphonesimulator/niaoyutong.build/Objects-normal/x86_64/EaseBubbleView+Image.o conflicts with same method from another category

解决方法:

有两个类目文件有同样的方法名,修改其中一个名字就OK了。 然后需要clean下项目。

5、警告信息:

ld: warning: directory not found for option '-F/Users/../workspaces/test-IOS/test/AipOcrSdk'
找不到某一个文件,是由于你更改了文件的目录路径了。

解决方法:

需要在: targets - > build setttings framework search Paths 里面 修改。。

剩下的就是自己代码的警告了,好解决。

!!!目前我项目中有一个警告没解决(在swift中用到了swizzling方式控制UIButton短时间内连续点击的方法):

Method 'initialize()' defines Objective-C class method 'initialize', which is not guaranteed to be invoked by Swift and will be disallowed in future versions

目前想到的办法是用OC来实现这个功能,然后桥接来用。
大家有什么更好的办法,希望指点一二。

Tip: 自己开发了好玩的APP: 《小明搜索》(App Store上搜索:"小明搜索")

点击下载 "小明搜索"
1、集必应、百度、搜狗为一体的搜索平台
2、用户随意收藏或添加自己喜欢的网站
3、网页文字播放功能
4、收藏网页的视频,本地播放
5、附加常用小工具
6、后台播放网页音频
7、3D Touch提供便捷入口
完全自定义的搜索助手,简约的爱不释手~
该APP不断完善中~

上一篇下一篇

猜你喜欢

热点阅读