Thursday, February 20, 2014

How to Mark API Method Deprecated

When a developer is required to make his/her own API, after been a while, there is always a chance to rewrite your existing ones, then publish the new ones for the other to use. Here
@interface SomeClass
-method __attribute__((deprecated));
__attribute((deprecated("use xxx method instead.")));
#include <AvailabilityMacros.h>
@interface SomeClass
-method DEPRECATED_ATTRIBUTE;  // or some other deployment-target-specific macro

- (void)myDeprecatedMethod __deprecated;
- (int)methodNameDeprecated:(int)param __deprecated;
Works too on classes
@interface MyDeprecatedClass

  // ... some properties and methods ...