1

I have this code that is supposed to run on iOS 6 and up. Apple deprecated some stuff on iOS 7 and at some point I have to have code like this:

if (isIOS7) 
   doItTheNewWay
else
   doItTheOldWay

the problem is that doItTheOldWay is deprecated on iOS7 and I see an error telling me that it was deprecated on iOS 7.

How do I get rid of this error in particular?

The line in the example is this:

    titleSize = [self.title sizeWithFont:font constrainedToSize:constrainedSize];
Duck
  • 34,902
  • 47
  • 248
  • 470
  • Do you want to fix this particular deprecicate warning or do you want to suppress all of theses warning messages? – user523234 Nov 21 '13 at 06:31

2 Answers2

1

You can use this, it works for me:

if (isIOS7)
    //doItTheNewWay
else
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
    //doItTheOldWay
#pragma clang diagnostic pop

Credit goes there.

Community
  • 1
  • 1
Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
0

In Xcode set Deprecated Functions to No.

Deprecated

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
  • thanks but your solution will turn off all deprecated messages and I have asked for a specific one. See null answer, much better. Thanks anyway. – Duck Nov 21 '13 at 06:44