0
我想存儲在覈心數據實體的設備文檔文件夾中的文件的文件路徑,它正在正確插入,但是當我試圖使用謂詞獲取記錄時它引發的路徑屬性是一個例外。在覈心數據中存儲文件路徑拋出異常
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the
format string "filePath==/Users/****/Library/Application Support/iPhone Simulator/5.1/Applications
/8C1B07FD-E372-4CD8-9A02-FDA321ECE629/Documents"'
這些屬性正確存儲在覈心數據數據庫中。
取出的代碼。
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
fetchRequest.predicate=[NSPredicate predicateWithFormat:[NSString stringWithFormat:@"filePath==%@",Path]];
NSSortDescriptor *sortDescriptor=[NSSortDescriptor sortDescriptorWithKey:@"fileName" ascending:YES];
fetchRequest.sortDescriptors=[NSArray arrayWithObject:sortDescriptor];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"File"
inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [self.managedObjectContext
executeFetchRequest:fetchRequest error:nil
];