On 01 Jan 2015, at 02:50, Jack Brindle <jackbrin...@me.com> wrote: > You might want to extend that. The header file indicates that containsString: > _only_ is available in OS X starting with 10.10 and iOS starting with 8.0. I > would expect this to crash, or at least behave very poorly, under any prior > OS since the call simply doesn’t exist there. > > Interesting that the only place it appears to be documented by Apple is in > the header file. It is widely “documented” at various web sites, but using > any call based on that is definitely rolling the dice. The central rule is > that if you are releasing code for others to run, be sure to use calls that > Apple documents to be available for the earliest targeted OS. > > I’d replace it with a more suitable call, which appears to be > rangeOfString:options: The header file indicates it should be called with no > options. in fact you probably should read the NSString header file info for > that call. It is somewhat interesting.
A good workaround is probably to create your own equivalent call with an identical signature in a category and just replace all calls to containsString with that: @implementation NSString (SBContainsStringBackwardsCompat) -(BOOL) sb_containsString: (NSString*)inString { return [self rangeOfString: inString options: 0].location != NSNotFound; } @end (Warning: code written in mail, never compiled) Then, when your baseline rises to 10.10, you can just do a search-and-replace of sb_containsString: to containsString:. Cheers, -- Uli Kusterer “The Witnesses of TeachText are everywhere...” http://zathras.de _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com