Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: suppressing all warnings for all external libraries

To disable compiler warning I go to Project -> Target -> Build Settings and add flag

-w

for specific file. This flag disables all warnings for the file.

But sometimes this flag does not work.

For example, when I run the test, I get warnings for external library Nimble (all this files I marked with the flag -w):

.../Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift:15:11: 'Matcher' is deprecated: Use to Predicate instead .../Pods/Nimble/Sources/Nimble/Matchers/Predicate.swift:170:22: 'Matcher' is deprecated: Use to Predicate instead .../Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift:22:27: 'Matcher' is deprecated: Use to Predicate instead .../Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift:76:21: Variable 'generator' was never mutated; consider changing to 'let' constant .../Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift:41:14: 'Matcher' is deprecated: Use to Predicate instead

What am I doing wrong and how to get rid of warnings for external libraries that I have no influence on?

like image 381
David Silva Avatar asked Sep 25 '17 19:09

David Silva


Video Answer


2 Answers

Quick Fix

I see you are using cocoapods. Cocoapods rewrite your configs each time you run pod install. So, you need to add this line in your podfile to ignore all warnings or warnings for a specific 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

NOTE: Sometimes it is good to see your warnings and your pod's warnings too, so you could prevent issues in the future.

like image 63
Gabriel Goncalves Avatar answered Oct 19 '22 23:10

Gabriel Goncalves


By the logs in your question, I see cocoapods in your project. Simply add the inhibit_all_warnings! flag to your podfile, this flag will hide the compilation warnings of third-party libraries installed with cocoapods.

More detailed description about using inhibit_all_warnings! flag see in alloy's answer.

like image 31
Vladimir Vishnyagov Avatar answered Oct 20 '22 00:10

Vladimir Vishnyagov