NSRegularExpressionSearch
is only compiled when
#if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED
So you need to check that the current operating system is 3.2 or later.
if ( [[[UIDevice currentDevice] systemVersion] doubleValue] >= 3.2 ) {}
In other cases you might check that a class exists or that an instance responds to a selector, but NSString did not change other than that enum. For example, if there was an enum associated with gesture recognizers you could use one of the following:
if ( NSClassFromString( @"UIGestureRecognizer" ) != nil ) {}
if ( [someView respondsToSelector:@selector(gestureRecognizers)] ) {}
For another example, see how Apple handles the UI_USER_INTERFACE_IDIOM macro.
Edit:
A version number to check besides the system version is NSFoundationVersionNumber
.
if ( NSFoundationVersionNumber > NSFoundationVersionNumber_iPhoneOS_3_1 ) {}
That is more closely tied to NSString, but there is no constant for 3.2 in the 3.2 headers.