下面列舉幾種常見的警告(基本可以保證把項目中的警告控制在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-
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 里面 修改。妄田。
剩下的就是自己代碼的警告了俺亮,好解決。
E蹦拧=旁!目前我項目中有一個警告沒解決(在swift中用到了swizzling方式控制UIButton短時間內連續(xù)點擊的方法):
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來實現這個功能启具,然后橋接來用本讥。
大家有什么更好的辦法,希望指點一二鲁冯。