nsmanagedobjectmodel

NSManagedObjectModel - create model dynamically

Deadly 提交于 2019-12-21 20:21:10
问题 Can anyone point me to a tutorial on building the core data model dynamically in Xcode? All tutorials I found are based on a static design but the apple documentation says it is possible to build the model programatically..sadly no example on that in apple documentation set. 回答1: You have to init a NSManagedObjectModel , then for each entity in your model you create an NSEntityDescription , then create an NSAttributeDescription per attribute. You can see a basic example from this post. http:/

Core data save model not working iOS

十年热恋 提交于 2019-12-11 20:23:24
问题 I have created a core data model and when trying to save records I get the following console message: Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x8b3bc50 {metadata={ NSPersistenceFrameworkVersion = 479; NSStoreModelVersionHashes = { }; NSStoreModelVersionHashesVersion = 3; NSStoreModelVersionIdentifiers = ( "" ); NSStoreType = SQLite; NSStoreUUID = "F49C0E04-9778-46EC-A9C7-9A045CD915D8"; "

'+entityForName: nil is not a legal NSPersistentStoreCoordinator for searching for entity name

给你一囗甜甜゛ 提交于 2019-12-07 23:33:07
问题 Getting the exception later in the program when _managedObjectModel is being used. Below is initialiser code. NSURL *modelURL = [[NSBundle mainBundle] URLForResource:self.managedObjectModelName withExtension:@"momd"]; _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; The problem is that _managedObjectModel is pointing to a garbage memory location. After analysing GPR and assembly code i found that the ManagedObjectModel was being initialised properly but,

How to use Core Data's ManagedObjectModel inside a framework?

两盒软妹~` 提交于 2019-12-04 15:15:58
问题 I'm trying to migrate a specific part of one of my apps into a framework so that I can use it in my app itself and in one of those fancy new iOS 8 widgets. This part is the one that handles all my data in Core Data. It's pretty straight forward to move everything over and to access it. I'm just having trouble accessing my momd file in there. When creating the NSManagedObjectModel I still try to load the momd as illustrated in Apple's code templates: NSURL *modelURL = [[NSBundle mainBundle]

How to use Core Data's ManagedObjectModel inside a framework?

落爺英雄遲暮 提交于 2019-12-03 09:31:16
I'm trying to migrate a specific part of one of my apps into a framework so that I can use it in my app itself and in one of those fancy new iOS 8 widgets. This part is the one that handles all my data in Core Data. It's pretty straight forward to move everything over and to access it. I'm just having trouble accessing my momd file in there. When creating the NSManagedObjectModel I still try to load the momd as illustrated in Apple's code templates: NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyApp" withExtension:@"momd"]; __managedObjectModel = [[NSManagedObjectModel alloc]

swift_dynamicCastClassUnconditional issues in swift

纵然是瞬间 提交于 2019-12-02 06:44:13
问题 I have the following NSManagedObject in swift: import Foundation import CoreData public class User: NSManagedObject { @NSManaged public var first_name: String @NSManaged public var last_name: String } I have a class which provides the value with a function below: - (id)getUserAtIndexPath:(NSIndexPath *)indexPath { User *user = [self.fetchedResultsController objectAtIndexPath:indexPath]; return user; } When I call this function from an Objective-C class, everything works fine. I call like so: