我想要实现的是在数组中搜索字符串,这是搜索数组的代码
if ([EssentialsArray containsObject:imageFilePath]) {
NSLog(@"YES");
}
else {
NSLog(@"NO");
NSLog(@"%@", ImageFilePath);
NSLog(@"%@", EssentialsArray);
}
NSLogs 为 imageFilePath 返回这个:
/var/mobile/Applications/5051DC84-CAC8-4C1D-841D-5539A1E28CB1/Documents/12242012_11025125_image.jpg
这对于 EssentialsArray:
(
{
EssentialImage = "/var/mobile/Applications/5051DC84-CAC8-4C1D-841D-5539A1E28CB1/Documents/12242012_11025125_image.jpg";
}
)
然后显然他们返回一个“NO”值,因为数组找不到字符串。提前致谢