2

After creating a new target in an iOS project, there are tons of deprecation warnings. I want to see these in the other targets, too.

I've searched my whole project for deprecated (as this answer would indicate) and I've also looked for -W (as mentioned here), and found that I did do this:

#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

in one or two places, but that's not it. I've looked at most answers regarding suppressing warnings, but I haven't found where I shut this off.

Where else might deprecation warnings been shut off? I would like to turn my warnings back on.

Example

This should result in a warning:

self.numericLabel.lineBreakMode = UILineBreakModeClip;// NSLineBreakByClipping;
Community
  • 1
  • 1
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
  • I'm confused. Are you trying to turn off the warnings or to re-enable the warnings that you turned off earlier (so the warnings start appearing again)? – rmaddy Aug 12 '13 at 22:00
  • 2
    Are you sure there should be deprecation warnings for your selected deployment target? – Vinod Vishwanath Aug 12 '13 at 22:00
  • 1
    Target -> Build Settings -> Deprecated Functions – danielbeard Aug 12 '13 at 22:00
  • I know it may sound stupid, but did you clean your project, and tried again and still shows the warning? – Adrian P Aug 12 '13 at 22:02
  • @VinodVishwanath yes, definitely. – Dan Rosenstark Aug 12 '13 at 22:07
  • @danielbeard checked that, it's set to `Yes` in the target that shows and the target that doesn't show. – Dan Rosenstark Aug 12 '13 at 22:08
  • @maddy I'll edit the question for clarity. I need to see the warnings. – Dan Rosenstark Aug 12 '13 at 22:08
  • @CodeMonkey sorry for the lack of clarity in the question. I've fixed it up. Yes, I've done clean and rebuild just like every hour ;) – Dan Rosenstark Aug 12 '13 at 22:13
  • Is it only deprecation warnings that have been turned off, or ALL warnings? Suggestion 2: If it's not too much of an inconvenience, could you create a new target with the same configs, and forget about the one that doesn't show warnings? – Vinod Vishwanath Aug 12 '13 at 22:25
  • @VinodVishwanath I've already created a new target from scratch and it does show the warnings. However, it's not exactly the same config. Also: I don't know if I've suppressed all warnings. It's definitely possible. – Dan Rosenstark Aug 12 '13 at 22:37
  • Check the Deployment Target setting for all of your targets. Deprecation warnings are only printed if your Deployment Target is newer than the first deprecation of the API. A newly-added target probably defaults to the newest Deployment Target, and your older targets are probably still using an older Deployment Target that still supported the now-deprecated API. – Greg Parker Aug 13 '13 at 00:30
  • What is the deployment target of your project/target? If your deployment target is iOS 4.3 or 5.x then you won't get a deprecation warning for `UILineBreakModeClip`. – rmaddy Aug 13 '13 at 00:37
  • Thanks @GregParker, that seems like it's the answer. Want to put it as an answer? I'll comment back if I learn that it's not the case. – Dan Rosenstark Aug 13 '13 at 19:12

1 Answers1

2

Because comments are folded up by default and sometimes get missed, I am elaborating on Greg's comment with an example.

Deprecation warnings are only printed if your Deployment Target is newer than the first deprecation of the API.

Example 1:
Using: [TWTweetComposeViewController canSendTweet]
Deprecation in Apple's document:NS_DEPRECATED(NA, NA, 5_0, 6_0)
Deployment Target: iOS 5.0
iOS SDK: 6.1
Warning: No

Example 2:
Using: [TWTweetComposeViewController canSendTweet]
Deprecation in Apple's document:NS_DEPRECATED(NA, NA, 5_0, 6_0)
Deployment Target: iOS 6.1
iOS SDK: 6.1
Warning: Yes

In Example1, the apple's deprecation document states that the api was introduced in iOS 5.0 and deprecated in iOS 6.0. So although my iOS SDK(xcode) was 6.1, I was not getting any warning since my deployment target was iOS 5.0 which would need that api.

In Example2, I changed my deployment target to iOS 6.1 and the warning started appearing.

Conclusion: Deployment target is generally the lowest iOS version that you want your app to support. If you set that to a version that's subsequent to the deprecation of an API, the warnings start showing up in Xcode

SayeedHussain
  • 1,696
  • 16
  • 23