nsmanagedobject

Does the performance of saving a ManagedObjectContext depend on the number of contained (unchanged) objects?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 07:11:56
问题 A general CoreData/SQLite question Is there a significant difference between these two scenarios when saving a NSManagedObjectContext using an SQLite store: After adding/changing/deleting one object in a NSManagedObjectContext containing 10 otherwise unchanged NSManagedObjects After adding/changing/deleting one object in a NSManagedObjectContext containing 10'000 otherwise unchanged NSManagedObjects 回答1: Generalizing from my experience with Enterprise Objects (which Core Data evolved from) I

How to change managed object class name before fetching

依然范特西╮ 提交于 2019-12-24 04:32:12
问题 I have a Swift app that uses CoreData. I created List entity with class MyAppTarget.List . Everything is configured properly in .xcdatamodeld file. In order to fetch my entities from persistent store, I am using NSFetchedResultsController : let fetchRequest = NSFetchRequest() fetchRequest.entity = NSEntityDescription.entityForName("List", inManagedObjectContext: managedObjectContext) fetchRequest.sortDescriptors = [ NSSortDescriptor(key: "name", ascending: true) ] let fetchedResultsController

How to change managed object class name before fetching

我是研究僧i 提交于 2019-12-24 04:32:02
问题 I have a Swift app that uses CoreData. I created List entity with class MyAppTarget.List . Everything is configured properly in .xcdatamodeld file. In order to fetch my entities from persistent store, I am using NSFetchedResultsController : let fetchRequest = NSFetchRequest() fetchRequest.entity = NSEntityDescription.entityForName("List", inManagedObjectContext: managedObjectContext) fetchRequest.sortDescriptors = [ NSSortDescriptor(key: "name", ascending: true) ] let fetchedResultsController

Could not locate NSManagedObjectModel for Entity

。_饼干妹妹 提交于 2019-12-24 00:30:21
问题 The is the code for the fetchRequest in viewDidLoad and the code is followed from a tutorial found here just that I'm linking the navigation controller and the tableview programmatically instead of using interface builder. The entity ProductInfo exists. However when I run the program I get the error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'ProductInfo'' I have reset the

State preservation and restoration strategies with Core Data objects in a UIManagedDocument

自闭症网瘾萝莉.ら 提交于 2019-12-23 20:13:23
问题 I'm starting to try and add support for state preservation and restoration to my iOS app, which has a Core Data component to it that I access via a UIManagedDocument. I'm starting to add the restoration identifiers to my view controllers, and have hooked up the required functions (currently empty) within my AppDelegate, and controllers. I have an object that could potentially be referenced by multiple view controllers so I plan to try and preserve and restore this within my AppDelegate and

State preservation and restoration strategies with Core Data objects in a UIManagedDocument

别等时光非礼了梦想. 提交于 2019-12-23 19:50:36
问题 I'm starting to try and add support for state preservation and restoration to my iOS app, which has a Core Data component to it that I access via a UIManagedDocument. I'm starting to add the restoration identifiers to my view controllers, and have hooked up the required functions (currently empty) within my AppDelegate, and controllers. I have an object that could potentially be referenced by multiple view controllers so I plan to try and preserve and restore this within my AppDelegate and

Using an NSValueTransformer to set values of an NSManagedObject instance

孤街醉人 提交于 2019-12-23 19:31:44
问题 I am using a custom NSValueTransformer to store color information in my Core Data store. The transformation between Transformable data and a UIColor instance works great once the color data is in the store already (ie once the app has been run and quit once already). However when I first run the app and am loading in these values (from a text file) they "stuck" as NSCFStrings. In this line of code "attributes" is a dictionary has keys which are NSManagedObject attribute names and values that

Mantle and Core Data : Only one Model

ぃ、小莉子 提交于 2019-12-23 13:25:11
问题 I'm starting to use Core Data with my Mantle Object (MTLModel) following this tutorial: http://chroman.me/core-data-and-mantle-one-to-many-relationship/ This article said : Since model classes inherit from NSManagedObject, which means that they can’t inherit from MTLModel, we need to use separated classes for Mantle and Core Data So, I have two class with the same properties: TrackMTL.m (MTLModel) Track.m (NSManagedObject) I'm looking for une solution without be forced to create two Model for

Add an instance of NSManagedObject to NSManagedObjectContext ok, updating the same instance failed

孤人 提交于 2019-12-23 12:29:25
问题 I am using core data in my iPhone app. I have created a simple class Friend , which derives from NSManagedObject and which uses the following property: @property (nonatomic, retain) NSString *name; I am able to add and delete instances of this class to my context and my changes are persistent also. Now I want to update/modify a Friend -instance and make it persistent again. But this seems not to work. Here is piece of code which shows my problem: // NSManagedObjectContext *context = < my

IOS App crash: [__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array

我与影子孤独终老i 提交于 2019-12-23 09:38:13
问题 I have a method I pass an 'id' into here: NSString *id = @"4bf58dd8d48988d181941735"; [self getNames:id]; This works fine, but when I use the 'id' from an object passed within the segue: NSString *id = _selectedStore._id; [self getNames:id]; I get the error: 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array' What's going on? Here's where it's getting the error. My attempt (keep in mind i'm new at this) is to take an array of Foursquare id's,