Insert availabilityOfNSNotFound == NSNotFound jokes here.
At some point, when Apple insisted on mandatory support for 64-bit devices (iOS 8.4 SDK?), The NSNotFound announcement was changed from:
enum {NSNotFound = NSIntegerMax};
to
static const NSInteger NSNotFound = NSIntegerMax;
You can check this in <Foundation/NSObjCRuntime.h> .
The documentation has never changed, so the availability of enum NSNotFound no longer in the SDK. But with iOS 9 and above, static const NSInteger NSNotFound .
Although I canβt answer the true availability of NSNotFound since I donβt work for Apple (as a developer, I think it is safe to use in all versions of iOS since version 2.0, otherwise many Foundation classes will break, since they can return NSNotFound ) , you can check if the memory location for NSNotFound NULL:
#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wtautological-compare" BOOL found = (&NSNotFound != NULL); #pragma clang diagnostic pop if (found) { NSLog(@"meh"); }
Jal
source share