managedobjectcontext

How to Save Data When Using One ManagedObjectContext and PersistentStoreCoordinator with Two Stores

瘦欲@ 提交于 2019-12-22 10:35:50
问题 PROBLEM STATEMENT When attempting to save a record to a read/write store that is one of two SQLite stores assigned to the same PersistentStoreCoordinator, my iPhone app crashes. One obvious issue when saving a record is the PersistentStoreCoordinator does not know in which Store to save the data (only because I don't know how to make this happen). First I will provide the big picture to make sure my approach is sound. Then I will supply the implementation details. BACKGROUND This is a

Why would app try to save to PLSharedManagedObjectContext?

▼魔方 西西 提交于 2019-12-13 05:29:18
问题 The following is a crash report I received from my crash reporting service, HockeyApp. The reason for the failure is a failure to save in PLSharedManagedObjectContext. I (think) I am doing all of my saves in the main app delegate managedObjectContext. Why is the PLSharedManagedObjectContext the one being saved to? I think this is the relevant code: -(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { __ENTERING_METHOD__ DLog(@

Getting error after trying to save core data record

狂风中的少年 提交于 2019-12-11 19:43:01
问题 i have a view controller to add a core data record. The core data entity name is FavoriteThings, the attribute is thingname. I have a save button action called SaveButtonAction. When I tap inside the button, the text inserted in the textfield called ToDoTextField should be stored, but the app crashed showing following log error: 2013-12-09 12:30:07.488 Favorite Things[1701:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+entityForName: nil is not a

How do I utilize CoreData when moving from collection view to detail view

瘦欲@ 提交于 2019-12-11 06:33:13
问题 I have an IOS app that is using RestKit to pull json formatted data from a server into a CoreData Entity. Some of the attributes of the entity help populate a collection view with an image and title for each cell. I am attempting to move from the collection view to a detail view when a cell is selected. There is a "summary" attribute of the CoreData Entity that I would like to display in the detail view along with the image. I know I can pass data thru the prepareForSegue method. But I am not

Core Data: should I be fetching objects from the parent context or does the child context have the same objects as the parent?

爷,独闯天下 提交于 2019-12-06 05:03:47
问题 I am slightly confused about parent/child contexts for ManagedObjectContext . When I setup a child context and set the parent context, does the child context contain all the objects of the parent context? I am using the stock Core Data methods that get created in the AppDelegate , but I changed the ConcurrencyQueue to main. In my method that is supposed to update the db: Create child context, set parent context Perform block on child context Fetch from parent context Create or update object

How to Save Data When Using One ManagedObjectContext and PersistentStoreCoordinator with Two Stores

最后都变了- 提交于 2019-12-06 00:28:31
PROBLEM STATEMENT When attempting to save a record to a read/write store that is one of two SQLite stores assigned to the same PersistentStoreCoordinator, my iPhone app crashes. One obvious issue when saving a record is the PersistentStoreCoordinator does not know in which Store to save the data (only because I don't know how to make this happen). First I will provide the big picture to make sure my approach is sound. Then I will supply the implementation details. BACKGROUND This is a simplified example representing the key aspects of the actual app I am working on. Seed Data User Input

Core Data: should I be fetching objects from the parent context or does the child context have the same objects as the parent?

痴心易碎 提交于 2019-12-04 07:54:05
I am slightly confused about parent/child contexts for ManagedObjectContext . When I setup a child context and set the parent context, does the child context contain all the objects of the parent context? I am using the stock Core Data methods that get created in the AppDelegate , but I changed the ConcurrencyQueue to main. In my method that is supposed to update the db: Create child context, set parent context Perform block on child context Fetch from parent context Create or update object in child context Call save on child context Have Notification listener to handle child context saves