NS_CLASS_AVAILABLE doesn't work

I'm trying to use NS_CLASS_AVAILABLE (NS_CLASS_AVAILABLE_IOS to be precise) in a project, but it doesn't seem to work.
I tried:

NS_CLASS_AVAILABLE_IOS(7_0) @interface Dummy : NSObject
@end

      

Then when I tried to check if the class is available:

if ([Dummy class]) {
  NSLog(@"Dummy available");
} else {
  NSLog(@"Dummy not available");
}

      

I always get "Dummy available", even in the iOS 6 simulator.
To check what I tried with NSURLSession:

if ([NSURLSession class]) {
  NSLog(@"NSURLSession available");
} else {
  NSLog(@"NSURLSession not available");
}

      

And this time I got it right that "NSURLSession is not available".

Is there something I am doing wrong?
Is there a compiler flag or something else?

+3


source to share





All Articles