Xcode:禁止所有外部库的所有警告

Dav*_*lva 9 xcode swift swift3 xcode8

要禁用编译器警告,我转到Project - > Target - > Build Settings并添加标志

-w
Run Code Online (Sandbox Code Playgroud)

特定文件.此标志禁用该文件的所有警告.

但有时这个标志不起作用.

例如,当我运行测试时,我收到外部库Nimble的警告(所有这些文件我用标志-w标记):

.../Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift:15:11:'Matcher'已弃用:用于谓词代替.../Pods/Nimble/Sources/Nimble/Matchers/Predicate.swift: 170:22:'Matcher'已被弃用:改为使用谓词.../Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift:22:27:'Matcher'已弃用:用于谓词代替.../Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift:76:21:变量'generator'从未发生变异; 考虑更改为'let'常量.../Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift:41:14:'Matcher'已弃用:用于谓词代替

我做错了什么以及如何摆脱对我没有影响的外部图书馆的警告?

Gab*_*ves 13

快速解决

我看到你正在使用cocoapods.Cocoapods每次运行时都会重写你的配置pod install.因此,您需要在您的行中添加此行,podfile以忽略特定pod的所有警告警告:

# example to ignore all warnings from all pods
inhibit_all_warnings!

# example to ignore warnings from a specific pod
pod 'Alamofire', :inhibit_warnings => true
Run Code Online (Sandbox Code Playgroud)

注意:有时也可以看到您的警告和您的吊舱警告,这样您就可以防止将来出现问题.