Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谁能指出我在 Xcode 中动态构建核心数据模型的教程?我发现的所有教程都是基于静态设计的,但苹果文档说可以以编程方式构建模型。遗憾的是,苹果文档集中没有这方面的例子。
您必须初始化 a NSManagedObjectModel,然后为模型中的每个实体创建一个NSEntityDescription,然后创建NSAttributeDescription每个属性。您可以从这篇文章中看到一个基本示例。
NSManagedObjectModel
NSEntityDescription
NSAttributeDescription
http://iphonedevsdk.com/forum/iphone-sdk-development/45944-want-to-create-a-parent-entity-programmatically-in-manegedobjectmodel.html