NSManagedObjectModel - create model dynamically

2019-04-11 03:14发布

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条回答
Summer. ? 凉城
2楼-- · 2019-04-11 03:55

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://iphonedevsdk.com/forum/iphone-sdk-development/45944-want-to-create-a-parent-entity-programmatically-in-manegedobjectmodel.html

查看更多
登录 后发表回答