ios7中containsString方法报错

containsString是ios8的方法,在ios7中不能使用

ios7中使用range.location

if (kIsIOS7) {

NSRange range = [uri rangeOfString:@".."];

if(range.location != NSNotFound)

{

// 存在

uri = [uri stringByReplacingOccurrencesOfString:@".." withString:@""];

}

}else{

if([uri containsString:@".."]){

uri = [uri stringByReplacingOccurrencesOfString:@".." withString:@""];

}

}

你可能感兴趣的:(ios7中containsString方法报错)