Skip to content

Instantly share code, notes, and snippets.

@hborders
Created September 12, 2013 14:10
Show Gist options
  • Save hborders/6538030 to your computer and use it in GitHub Desktop.
Save hborders/6538030 to your computer and use it in GitHub Desktop.
Demonstrates a category that should trigger deprecation warnings for an Objective-C method, but doesn't.
@interface UINavigationController (Deprecations)
- (id)initWithRootViewController:(UIViewController *)rootViewController __attribute__((deprecated));
@end
// no implementation of UINavigationController (Deprecations) should be necessary. I just want to add the attribute
// should this be a class extension instead of a category?
@interface SomethingThatUsesNavigationController : UIViewController
@end
@implementation
- (IBAction)buttonPressed {
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:[UIViewController new]]; // this should trigger a deprecation warning, but doesn't for me.
[self presentViewController:navigationController animated:YES completion:NULL];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment