我收到以下錯誤,當我打電話[self.fetchedResultsController performFetch。錯誤[NSFetchedResultsController performFetch]
*終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因是:「* - [的NSFileManager fileSystemRepresentationWithPath:]:轉換失敗/用戶/ ivanevf /庫/應用程序支持/ iPhone模擬器/ 5.1 /應用/ 0EF75071- 5C99-4181-8D4D-4437351EC1F4/Library/Caches/.CoreDataCaches/SectionInfoCaches/0
這是我在初始化控制器後所做的第一個調用。初始化如下所示:
- (NSFetchedResultsController *)fetchedResultsController
{
if (_fetchedResultsController != nil) {
return _fetchedResultsController;
}
// Create and configure a fetch request with the Book entity.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Conversation" inManagedObjectContext:self.objectContext];
[fetchRequest setEntity:entity];
// Create the sort descriptors array.
NSSortDescriptor *msgAgeDescriptor = [[NSSortDescriptor alloc] initWithKey:@"message" ascending:NO comparator:^NSComparisonResult(id obj1, id obj2) {
// some code
}];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:msgAgeDescriptor, nil];
[fetchRequest setPredicate:[self fetchPredicate]];
[fetchRequest setSortDescriptors:sortDescriptors];
NSString *cacheName = [NSString stringWithFormat:@"%d%Conversation%d", self.viewType, self.location.bid];
// Create and initialize the fetch results controller.
_fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.objectContext sectionNameKeyPath:nil cacheName:cacheName];
_fetchedResultsController.delegate = self;
return _fetchedResultsController;
}
任何想法這裏發生了什麼? 謝謝!
p.s.我嘗試了幾個隨機的東西: 1.從模擬器中刪除應用程序目錄。 (/用戶/ ivanevf /庫/應用程序支持/ iPhone模擬器/ 5.1 /應用/ 0EF75071-5C99-4181-8D4D-4437351EC1F4) 2.註釋掉setPredicate,setSortDescriptors線方法調用
你是一個紳士和學者。我現在會在一個恥辱的角落裏哭泣。 – Ivan 2012-04-27 20:14:29