问题描述
是否可以从现有的SQLite数据库文件生成.xcdatamodel(CoreData数据模型)?
Is it possible to generate a .xcdatamodel (CoreData data model) from an existing SQLite database file?
我开发了一个SQLite数据库并编写了一个Java API反对。现在,我需要写一个等效的iOS API到同一个数据库(文件)。我不想在xCode中手工创建数据模式。我只想生成.xcdatamodel,并使用xCode生成我将编码的实体类。
I've developed a SQLite database and written a Java API against it. Now, I need to write an equivalent iOS API to the same database (file). I'd prefer not to create the data schema by hand in xCode. I just want to generate the .xcdatamodel, and use xCode to generate the entity classes that I'll code against.
有可能吗?
推荐答案
请参阅和。我知道你不是具体要求使用整个数据库,而只是创建模型,但你必须明白,现有的SQLite数据库和Core Data想要存储的数据之间没有1-1关系。
See How do I use my existing SQLite database with Core Data? and Efficiently Importing Data. I understand that you're not asking specifically about using the entire database but just creating the model, but you have to understand that there's not a 1-1 relationship between an existing SQLite database and what Core Data wants to store.
这篇关于来自现有SQLite数据库的核心数据数据模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!