CoreData Problems
CoreData Problems
- Subject: CoreData Problems
- From: Gordon Apple <email@hidden>
- Date: Mon, 05 Jul 2010 14:43:46 -0500
- Thread-topic: CoreData Problems
We're doing our first iPad (simulator only at this time) CoreData project
and having a multitude of problems. We have a sectioned table in one of our
tabs. The CD stack is created in the appDelegate's
didFinishLaunchingWithOptions by using:
self.fetchedResultsController.delegate = self;
This sets up the results controller and CD stack by calling and unwinding
the frc, context, persistentStoreCoordinator, mom using standard published
techniques. Table sections are determined by a "sectionName" parameter in
the primary entity. We then read a series of files to pre-populate one
section, using the frc to fetch any existing items, compare them with the
file items, and only create new objects if they are not already in the
database, then save the context.
When selecting the table view tab, in its viewController viewDidLoad, we set
the frc delegate to the viewController. In this view, the user can
add/delete new items in a new section (preloaded section is not editable).
Context is saved for each add/delete.
None of this worked until, in the app delegate didFinishLaunchingWithOptions
, we added [NSFetchedResultsController deleteCacheWithName:nil] to first
clear the caches.
If we trash the sqlite database file to start from scratch, the
pre-population seems to work. However, when going to the table tab, nothing
appears. In the frc delegates, the frc shows zero sections.
If we quit the app and relaunch (keeping the sqlite file), now the table
will load and things seem to work correctly.
According to the specs, caches are maintained across launches. So why do we
have to dump first? Also, why isn't the frc picking up the pre-loaded
section? Any theories?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden