dfmuir
dfmuir

Reputation: 2088

How can I have Xcode warn other developers of methods not supported by there build target?

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!

Upvotes: 0

Views: 154

Answers (1)

Ajith Renjala
Ajith Renjala

Reputation: 5162

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

Here is a SO answer which could also help you.

Upvotes: 1

Related Questions