Swift 2, warning: could not load any Objective-C class information from the dyld shared cache

For anyone coming across this in the future, I just ran into this problem myself and it turned out that I was actually getting a stack overflow from a recursive function. Apparently calling setValue:forKey: on an NSObject calls the respective set[Key] function, where [Key] is the (capitalized) name you gave to the forKey section. So, … Read more

Core Data “use scalar properties for primitive data types” check box

Before iOS 5 and OSX 10.7 scalar properties can’t be auto-generated and you had to add setter and getter implementations, which cause some penalty. Auto-generated properties are optimized. I’m not aware of any other penalties. Scalar and non-scalar properties are represented by the same types in DB, so there will be no change in DB’s … Read more

Use CoreData or SQLite on iPhone? [closed]

This is a common question here: “Core Data vs. SQLite for SQL experienced developers” “Core Data vs Sqlite and performance…” “Core Data vs sqlite3” “is it worth using core data for a simple sqlite app on the iphone with one table and no relationships or complicated subtable/views?” In summary, Core Data can greatly simplify your … Read more

How do I copy or move an NSManagedObject from one context to another?

First, having more than one NSManagedObjectContext on a single thread is not a standard configuration. 99% of the time you only need one context and that will solve this situation for you. Why do you feel you need more than one NSManagedObjectContext? Update That is actually one of the few use cases that I have … Read more

How to unit test my models now that I am using Core Data?

You need to build a Core Data stack, either within each method or in -setUp and then tear it down. Using an NSInMemoryPersistentStore will keep things fast and in-memory for your unit tests. Add a @property (nonatomic,retain) NSManagedObjectContext *moc to your TestCase subclass. Then: – (void)setUp { NSManagedObjectModel *mom = [NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObject:bundleContainingXCDataModel]]; NSPersistentStoreCoordinator *psc … Read more

How can I track/observe all changes within a subgraph?

You will want to listen for the NSManagedObjectContextObjectsDidChangeNotification to pick up all changes to your data model. This can be done using code like the following: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDataModelChange:) name:NSManagedObjectContextObjectsDidChangeNotification object:myManagedObjectContext]; which will trigger -handleDataModelChange: on any changes to the myManagedObjectContext context. Your -handleModelDataChange: method would look something like this: – (void)handleDataModelChange:(NSNotification *)note { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)