Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode no longer showing me deprecated warnings

I inherited an iOS project that targets iOS6+. A few weeks ago I moved it to Xcode 6 and cleaned up all of the warnings. One such warning was:

'UITextAttributeTextShadowColor' is deprecated: first deprecated in iOS 7.0 - Use NSShadowAttributeName with an NSShadow instance as the value

My fix to this used NSShadowAttributeName, but I did it improperly and it caused the app to crash at a certain point during execution. When I discovered this weeks later, I reverted to the old code temporarily. However, when I reverted to the old code, the deprecation warnings did not come back. I have been unable to figure out why and would like to remedy this - it alarms me that warnings aren't being shown.

For what it is worth, in certain sections of code I needed to silence deprecation warnings as a result of needing to maintain support for iOS 6. In those instances, there is separate code for iOS 6 and iOS 7+ devices and the iOS 6 code is surrounded with:

SILENCE_IOS7_DEPRECATION(

// iOS 6 code here

);

(see https://stackoverflow.com/a/26564750/3352624) This uses:

#define SILENCE_DEPRECATION(expr)                                   \
do {                                                                \
_Pragma("clang diagnostic push")                                    \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")   \
expr;                                                               \
_Pragma("clang diagnostic pop")                                     \
} while(0)

#define SILENCE_IOS7_DEPRECATION(expr) SILENCE_DEPRECATION(expr)
#define SILENCE_IOS8_DEPRECATION(expr) SILENCE_DEPRECATION(expr)

I opted against adjusting Xcode settings and turning off warnings for large amounts of code.

So I'm confused why the deprecation warnings no longer show when I revert the code back to what it was before.

Here's what I've tried:

  1. Removed all references to the SILENCE_DEPRECATION macro from my code
  2. Verified Deprecated Functions is on under Build Settings for the target
  3. Verified my Base SDK is set to Latest iOS (8.1) and my iOS Deployment Target is set to iOS 6.0
  4. Added the -Weverything to Other Warnings Flags under Build Settings for the Target
  5. Checked out an old version of my workspace from git which was before any of my changes
  6. Quit and restarted Xcode 6
  7. Tried Xcode 5
  8. Restarted my computer, then started Xcode

None of these things caused the deprecation warnings to come back. Any ideas what should I try next?

like image 864
davew Avatar asked Mar 17 '23 22:03

davew


1 Answers

I realize this is a pretty old thread, but I thought I'd post an answer in case others find this thread.

It also depends on the Deployment Target setting of the Target (i.e., under "TARGETS", click the app and choose "General" at the top, look in the "Deployment Info" section for "Deployment Target"). For example, if I have the Deployment Target at 7.1 and use functions that were deprecated in iOS 8, I won't get warnings. However, if I set the Deployment Target to 8.x or 9.0, I will get warnings for those functions.

like image 74
guywithmazda Avatar answered Mar 20 '23 06:03

guywithmazda