PerformFetch çökmesini NSFetchedResultsController: cache kullanırken
NSFetchedResultsController kullanma tarihleri kullanarak kesitli olan nesneler, bir sürü görüntülemek için yapıyorum. Yeni bir kurulum, bu mükemmel bir şekilde çalışıyor ve tüm nesneleri, tablo görünümünde görüntülenir. Ancak, uygulamayı yeniden hizmete ne zaman bir kaza olsun. Ben NSFetchedResultsController başlatılıyor zaman bir önbellek belirtin ve her zaman mükemmel çalışıyor.
Benim NSFetchedResultsController yaratırım.
- (NSFetchedResultsController *)results {
// If we are not nil, stop here
if (results != nil)
return results;
// Create the fetch request, entity and sort descriptors
NSFetchRequest *fetch = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:self.managedObjectContext];
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"utc_start" ascending:YES];
NSArray *descriptors = [[NSArray alloc] initWithObjects:descriptor, nil];
// Set properties on the fetch
[fetch setEntity:entity];
[fetch setSortDescriptors:descriptors];
// Create a fresh fetched results controller
NSFetchedResultsController *fetched = [[NSFetchedResultsController alloc] initWithFetchRequest:fetch managedObjectContext:self.managedObjectContext sectionNameKeyPath:@"day" cacheName:@"Events"];
fetched.delegate = self;
self.results = fetched;
// Release objects and return our controller
[fetched release];
[fetch release];
[descriptor release];
[descriptors release];
return results;
}
Bu app çöküyor bu mesajlar
FATAL ERROR: The persistent cache of section information does not match the current configuration. You have illegally mutated the NSFetchedResultsController's fetch request, its predicate, or its sort descriptor without either disabling caching or using deleteCacheWithName:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FATAL ERROR: The persistent cache of section information does not match the current configuration. You have illegally mutated the NSFetchedResultsController's fetch request, its predicate, or its sort descriptor without either disabling caching or using deleteCacheWithName:'
Ben gerçekten özel bir şey yaptığıma inanmıyorum gibi bu neden olacağını söyleyerek bunu neden hiçbir ipucu var. Tek potansiyel sorun ben yeni bir nesne oluştururken, bu yapı hangi bölüm başlığı (gün).:
// Set the new format
[formatter setDateFormat:@"dd MMMM"];
// Set the day of the event
[event setValue:[formatter stringFromDate:[event valueForKey:@"utc_start"]] forKey:@"day"];
Belirttiğim gibi, bu tüm iyi eğer önbellek söz konusu ise orada çalışıyor. Herhangi bir yardım için teşekkür ederiz!
CEVAP
Apple 4.0 yeni iOS piyasaya ne zaman uygulamalarım biri ile benzer bir sorunu vardı. Arama:
fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:[self managedObjectContext] sectionNameKeyPath:nil cacheName:nil];
Ve nil için parametre cacheName değerini ayarlayın. Benim için çalıştı, sizin için umuyoruz. Bana haber ver.
'Tüm özel durumları kesme s " Gün...
Orada herhangi bir şekilde veri kullan...
Web kullanırken ReplacableToken_.confi...
Java kullanarak Göster.() containsKey ...
Hata kullanırken sınıfının statik olma...