以下示例程序输出相同,但程序无法正常工作。
NSDirectoryEnumerator *directoryEnumerator = [[NSFileManager defaultManager]
enumeratorAtPath:kDocdir];
for (NSString *pathi in directoryEnumerator)
{
NSString *fileName_Manager = [pathi lastPathComponent];
NSLog(@"fileName_Manager = %@",fileName_Manager);
Artist *name_Databse = [self.fetchedResultsController
objectAtIndexPath:IndexPath];
NSLog(@"name_Databse = %@",name_Databse.name);
if ([fileName_Manager isEqualToString:name_Databse.name]) {
NSLog(@"Same Name");
}else{
NSLog(@"Different Name");
}
}
输出:
2013-04-25 15:37:43.256 Player[36436:907] fileName_Manager = alizée - mèxico - final j'en
2013-04-25 15:37:43.272 Player[36436:907] name_Databse = alizée - mèxico - final j'en
2013-04-25 15:37:44.107 Player[36436:907] Different Name
当名称中有特殊字符时无法正常工作。为什么会这样?谢谢 ...
这里有同样的问题:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name == %@",[pathi lastPathComponent]];
如何在这里进行编辑?