Until now in Xcode 6 I was able to suppress warnings for some external libraries by using pragma directives, like this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#import "SwiftToObjectiveC-Swift.h"
#pragma clang diagnostic pop
Since I updated my project to Xcode 7 this directives seem to do nothing, I get all the documentation warnings that are on SwiftToObjectiveC-Swift.h.
Anyone has an idea what it could be the problem?
Thanks!
Related
I'm updating my app to support iOS 11 and I added the large titles options in the interface builder. Now I'm getting these "Attribute unavailable - prefers large titles before iOS 11.0" warnings.
I know I can set the options programmatically, but that's causing some other problems, so I was hoping I could keep it at the storyboard and just ignore the warnings. If the options aren't available that's fine, just don't use them. Is there a way to do that?
I know there are other questions asking the same thing, but they're pretty old and the answers end up working around it instead of really dealing with the warnings.
As the error states, your app is probably targeting iOS <11 so the attribute will not be used for earlier versions.
Have you tested your app in iOS 11 and 10 ?
Solutions:
Disable that feature
Set it in code using if #available (Best option if you want to maintain compatibility with earlier iOS versions and use that feature)
Set the target of your project to iOS 11
Suppress all warnings / Storyboard files only (Not recommended)
Since the OP does not state whether Swift or Objective-C is being used, I will post both versions.
Swift 2.0+: if #available(iOS 11, *) {}
Obj-C: if (#available(iOS 11, *)) {}
Courtesy of How to check iOS version?
As a side note I was able to suppress the specific warning with
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunguarded-availability"
... your code here ...
#pragma GCC diagnostic pop
Not recommending that - but as a quick fix it works.
I have included the RETableview manager library from POD. I need to remove the warnings currently I am getting. What are the best ways of receiving the updates
You can use surpress a lot of warning generated from clang from either build options or in your code. For instance, if you had a unused variable you didn't want to keep getting warned about, you could do this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
let a = 1;
#pragma clang diagnostic pop
The basic idea is to edit compiler diagnostics and then restore them. When your source file is compiled it will basically ignore that line from a diagnostic perspective. You can do a lot more with the pragma marks as well, check out clang's user manual.
i want to ignore these warnings these warning appeared when i used
valid architechtures : arm64 armv7 armv7s
these type of warnings appearing in many headers .
i want to ignore these warnings just like clang does for deprecated warnings.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
i want something like this or any compiler flags to ignore these warnings
If you go to the log navigator (the last tab on the left panel in Xcode), you can expand the "transcripts" (see View and filter logs and reports). Once you find the one that shows the build warnings, you can see what the precise -W code for each is, and then suppress it via your #pragma.
Thus, in your revised question, you show us the -W code in question is -Wobjc-property-no-attribute. Thus you could do:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-property-no-attribute"
...
#pragma clang diagnostic pop
This is related to my other question
When I build my project with Apportable, it assumes Linux/Android platform. I think these preprocessor flags are set.
__linux
ANDROID
But, my source code (OpenGL drawing) is not ready for Android, and only for iOS. So I want to detect some preprocessor flag for Apportable (not Linux or Android), and perform some iOS specific processing.
How can I detect Apportable platform in preprocessing stage? (What is pre-defined preprocessor flag for Apportable?)
You can easily verify if a preprocessor macro is defined by using the message pragma:
// will always print, to detect cases where file wasn't actually built
#pragma message "-------------------------ALWAYS----------------------------"
// if the macros are defined, the pragma message should be logged
#ifdef __linux
#pragma message "__linux"
#endif
#ifdef ANDROID
#pragma message "ANDROID"
#endif
This will print out warning messages for macros that are defined:
/.../KTTypes.h:15:9: warning: -------------------------ALWAYS---------------------------- [-W#pragma-messages]
#pragma message "-------------------------ALWAYS----------------------------"
^
/.../KTTypes.h:17:9: warning: __linux [-W#pragma-messages]
#pragma message "__linux"
^
/.../KTTypes.h:20:9: warning: ANDROID [-W#pragma-messages]
#pragma message "ANDROID"
So yes, ANDROID and __linux are both defined when building with apportable, and not defined when building from within Xcode.
ANDROID will be defined by the build system, however since the Apportable platform has numerous features that stock Android will not. APPORTABLE is defined to signify builds by the apportable build system.
You can find additional build flags specific for Apportable builds in
~/.apportable/SDK/site_scons/android/ndk.py
I was trying to use -dumpversion to determine if the compiler is usable.
My project compiles with clang and newer gccs, but not with the old gcc 4.2.1.
So why does clang pretend to be an old gcc?
Extra questions, is it possible to change this value at runtime?
Or does anyone have a nice autoconf macro to determine the compiler version with both clang and gcc?
Clang was originally written to be compatible with gcc 4.2.1. There has been some discussion about updating that number earlier this year, but there were issues.
For autoconf checking, clang suggests to use its __has_feature extension. Clang's document has a list of things you can check with __has_feature too.