I have this code that checks the database to see if there is a duplicate and that works the only problem is that if there is not a duplicate it won't save the new entry it just crashes the app.
2012-01-25 11:45:41.351 DataBase 72740:fb03] After managedObjectContext: <NSManagedObjectContext: 0x8992ea0>
2012-01-25 11:45:47.272 DataBase[72740:fb03] CoreData: 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:
2012-01-25 11:45:47.273 DataBase[72740:fb03] CoreData: error: fetch request = <NSFetchRequest: 0x6e66e10> (entity: Entry; predicate: (name CONTAINS[cd] "NOW!!!!"); sortDescriptors: ((
"(name, ascending, compare"
)); batch size: 20; type: NSManagedObjectResultType; )
2012-01-25 11:45:47.274 DataBase[72740:fb03] CoreData: error: cached objects were: (
"<NSManagedObject: 0x6ba9fc0> (entity: Data; id: 0x6ba8680 <x-coredata://8CB27725-AD44-411F-AABA-51351AF0E9FB/Guns/p1> ; data: {\n
)
2012-01-25 11:45:47.275 DataBase[72740:fb03] CoreData: error: fetched objects are: (
)
2012-01-25 11:45:47.277 DataBase[72740:fb03] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CoreData: 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:'
*** First throw call stack:
(0x154b052 0x1affd0a 0x1185e53 0xa1f1 0x154cec9 0x1d25c2 0x40dd54 0x154cec9 0x1d25c2 0x1d255a 0x277b76 0x27803f 0x2772fe 0x1f7a30 0x1f7c56 0x1de384 0x1d1aa9 0x2438fa9 0x151f1c5 0x1484022 0x148290a 0x1481db4 0x1481ccb 0x2437879 0x243793e 0x1cfa9b 0x2aa8 0x2a05 0x1)
terminate called throwing an exceptionkill
Any ideas?
Last edited by Jonathansm; 01-25-2012 at 02:28 PM.
core data does not always make a lot of sense, but with the apps I have, I only generate NSManagedObjectContext in the top appDelegate and then pass that context to all view controllers in the app. So I never create a context in my view controllers. Just use the existing one. That seems to work.
Well I got it working again I think was the problem was is that I had the cache named the same as the one in the master view. Don't know if that really is the problem or I just got lucky but so far its still working.
I have created a view in which I can edit a entry. The edit view displays the everything correctly in text boxes if I change any of those and save it, it adds another entry instead of editing it. How do I make it edit the entry instead of adding another one? I am using NSPredicate to get the data info I don't know if makes any difference.
I have created a view in which I can edit a entry. The edit view displays the everything correctly in text boxes if I change any of those and save it, it adds another entry instead of editing it. How do I make it edit the entry instead of adding another one? I am using NSPredicate to get the data info I don't know if makes any difference.
Just don't insert a new object. Fetch your object, modify it, save your context.
__________________ Recall It!Tag your notes. Tag your photos. Tag your thoughts. Tag your life.