0

I am upgrading an open source project that I maintain to use the latest iOS 8 SDKs. To do this, I will be introducing some new methods that will not work at all with iOS 7 and previous operating systems. I would like to specify the @interface in such a way that someone implementing this library will see a warning in Xcode if they try to use one of these methods with a build target below iOS 8.

For example, if they had a build target of iOS 7, and tried to call mySpecialiOS8Method, they should get a warning flag on that line of code saying "Warning: mySpecialiOS8Method is not available for iOS 7, use crappieriOS7CompatibleMethod instead to maintain compatibility". These warnings should not be visible with an iOS 8 build target.

Does anyone have any ideas about this?

Thanks!

dfmuir
  • 2,048
  • 1
  • 17
  • 14
  • Mark it as being available as of iOS 8. Look at many of the Apple header files for how this is done. – rmaddy Oct 06 '14 at 03:04

1 Answers1

1

Using __ attribute__, you can warn when deprecated methods are used.

Here is a SO answer which could also help you.

Community
  • 1
  • 1
Ajith Renjala
  • 4,934
  • 5
  • 34
  • 42
  • I am not looking to deprecate methods, but rather the opposite. I have methods that are only available on iOS 8, but library still works on iOS 7 and 8 with the older methods. I want to disable using the iOS 8 only methods if the build target is less than iOS 8. – dfmuir Oct 07 '14 at 16:26