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:
Deprecated Functions
is on under Build Settings
for the targetBase SDK
is set to Latest iOS (8.1)
and my iOS Deployment Target
is set to iOS 6.0
-Weverything
to Other Warnings Flags
under Build Settings
for the TargetNone of these things caused the deprecation warnings to come back. Any ideas what should I try next?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With