下面的例子程序:虽然同样的url也找不到url,但是程序不能正常工作。
NSDirectoryEnumerator *directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:kDocdir];
for (NSString *pathi in directoryEnumerator)
{
NSLog(@"fileManager_url = %@",[self Doc_Del:pathi]);
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"url == %@",[self Doc_Del:pathi]];
[fetchRequest setPredicate:predicate];
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:nil];
Artist *url_Databse = [self.fetchedResultsController objectAtIndexPath:self.indexPath_k];
NSLog(@"Database_url = %@",url_Databse.url);
if ([fetchedObjects count] > 0) {
NSLog(@"foundurl = %@",((Artist *)[fetchedObjects objectAtIndex:0]).url);
}else{
NSLog(@"url not found");
}
}
输出:
2013-04-25 15:37:43.256 Player[36436:907] fileManager_url = /alizée -öş mèxico - final j'en
2013-04-25 15:37:43.272 Player[36436:907] Database_url = /alizée -öş mèxico - final j'en
2013-04-25 15:37:44.107 Player[36436:907] url not found
当 url 中有特殊字符时无法正常工作。为什么会这样?谢谢 ...