IOS系统适配

1.IOS7

__NSCFString containsString:]: unrecognized selector sent to instance 0x7f876b79e160

[weatherInfo containsString:@"转"]//ios 8后有的函数

If you want your code to work on iOS 7 as well as iOS 8 you should use one of the rangeOfString calls instead. Basically if the range returned has a length of zero, the substring is not there.

 

原文链接 

 

@implementation NSString (Contains)

- (BOOL)myContainsString:(NSString*)other {
  NSRange range = [self rangeOfString:other];
  return range.length != 0;
}

@end

 

http://stackoverflow.com/questions/26410420/nsstring-containsstring-crashes

posted @ 2016-06-22 11:14  niwanglong385  阅读(94)  评论(0)    收藏  举报