In my application I use 3rd party code that triggers some warnings. I reviewed them and they can be safely ignored.
Now I want to "mark" a file somehow, so Xcode won't show any warnings for the code in that file.
How should I do that?
In my application I use 3rd party code that triggers some warnings. I reviewed them and they can be safely ignored.
Now I want to "mark" a file somehow, so Xcode won't show any warnings for the code in that file.
How should I do that?
Select your target and show Build Phases. Then enter the name of the file in the search box, and you should see it listed in the Compile Sources phase. Double-click in the Compiler Flags column for that file and enter -w
to turn off all warnings for that file.
-w
to turn off all warnings, but perhaps the new compiler doesn't pay attention to that. In that case, turn off individual warnings. Find the warning in question in Build Settings, and show Quick Help in the Utilities view. You should see a description, with a -Wname-of-warning
syntax. Prepend "no-" to the name and specify that in Compiler Flags. Example: to turn off -Wunused-parameter
specify -Wno-unused-parameter
–
Rubyeruch -w
does the trick and in other project that uses plain GCC compiler -Wno-name-of-warning
is the only way to go. –
Smilacaceous -w
and LLVM). Really handy when you include thirdparty files you don't wand to modify. –
Peroxidase Select Project in left navigator and select target go to build phase and Put -w in Build Phase of target file. It will hide all compiler warnings
This works for Xcode 10.2+ and Swift 5
Manual fix:
Add -w -Xanalyzer -analyzer-disable-all-checks
to the problematic file from Xcode > Project > Targets > Compile Sources > Double click the file where you want to turn off warnings.
Cocoapods Fix:
If you're trying to suppress warnings from a problematic pod, you can automatically suppress all warnings from the dependency with the inhibit_warnings
flag in your podfile:
pod 'Kingfisher', '~> 4.6', :inhibit_warnings => true
© 2022 - 2024 — McMap. All rights reserved.
-w
turn off all the warnings or just a subset of possible warnings? – Smilacaceous