Reputation: 14417
I have imported the three20 project into my project, and when I upgraded to Xcode 4.2 with iOS 5, a bunch of warnings appeared in the project.
I don't care about them, but they make a lot of noise, and it's easy to miss any real warnings in my project now. Is there a way to disable warnings for those specific libraries?
Upvotes: 75
Views: 32959
Reputation: 5700
If you're using a third-party static library (libSomething.a
) and importing the headers from that library, this works to silence all warnings as of Xcode 15:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#include "someHeader.h"
#include "someOtherHeader.h"
#pragma clang diagnostic pop
(I saw some older comments that -Weverything
didn't work on older Xcode versions, but it does on 15 at least.) This is much more convenient than looking up individual warning flags in Clang's list of 19,457 flags.
Upvotes: 0
Reputation: 11378
If the warnings come from the included library or framework header files, you can wrap that include statements like this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#pragma clang diagnostic pop
Put your warning flag on the second line above. You can lookup a warning flags here: https://clang.llvm.org/docs/DiagnosticsReference.html
Upvotes: 8
Reputation: 1390
If the warnings are coming from a framework (for me it was Rollbar) that was added with Carthage:
Carthage/Build/<platform>
into Xcode, adding it to the dummy/wrapper framework you just created (RollbarWrapper)Go to the Build Settings for the dummy/wrapper framework (RollbarWrapper) and set "Inhibit All Warnings" to Yes
Next, add the framework (Rollbar) to your application target's Frameworks, Libraries, & Embedded Content section and set to Do Not Embed
copy-frameworks
script to copy the Rollbar framework)Upvotes: 0
Reputation: 1514
If you are using pods, you can add this to your podfile to prevent warnings logging:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES"
end
end
end
Upvotes: 21
Reputation: 6205
If your third-party libraries are added as a separate target, you can check Inhibit all warnings
for that specific target to turn all warnings off.
If your library is added as plain source files to your current target, you can set -w
compiler flag for individual sources to mute all warnings in them. You have to go to Build phases
menu of your target configuration and set this flag for each source file in Compile Sources
section by double clicking on each file end entering -w
flag.
Upvotes: 162