Suppressing deprecated warnings in Xcode Suppressing deprecated warnings in Xcode xcode xcode

Suppressing deprecated warnings in Xcode


Since I yet can not add a comment to the @samiq post, I think I will expand it. Input mentioned directive before a function / method in which you use deprecated stuff. Then you can restore the previous setting after the definition of the function end:

#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations"- (void) methodUsingDeprecatedStuff {    //use deprecated stuff}#pragma GCC diagnostic pop


Clang provides a nice feature that makes the "restore" step in the @manicaesar post independent of the initial warning state:

#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wdeprecated-declarations"- (void) methodUsingDeprecatedStuff {    //use deprecated stuff}#pragma clang diagnostic pop

To quote the Clang manual:

In addition to all of the functionality provided by GCC's pragma, Clang also allows you to push and pop the current warning state. This is particularly useful when writing a header file that will be compiled by other people, because you don't know what warning flags they build with.


Try -Wno-deprecated-declarations, or its corresponding setting in Xcode, GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS (pro tip: just type in "deprecated" in the build settings to find the specific setting for this warning).

Current versions of Xcode (e.g. Xcode 9.2):

enter image description here


Ancient versions of Xcode (e.g. Xcode 2.x, 3.x):

enter image description here