0

我得到了 iOS 数据模型,由 16 个实体(我猜是表)组成。所以,当我在做这个应用程序的 Android 版本时,我需要以某种方式自动(首选方式)或导入这个模型,或者我需要创建 SQL 查询才能做到这一点。

现在,这是 16 个表,稍后需要使用 Web 服务进行复制,所以我想保持数据库原样。

解决这个问题的最佳方法是什么,以及在哪里创建数据库,就像在原始数据库中一样,在应用程序加载时使用的一些首选项位于该特定数据库的“设置”表中。

肿瘤坏死因子

编辑 1:来自 iOS 前两个表的 XML 模型:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1487" systemVersion="11E53" minimumToolsVersion="Xcode 4.1" macOSVersion="Automatic" iOSVersion="Automatic">
<entity name="FAQItem" representedClassName="FAQItem" syncable="YES">
<attribute name="answer" attributeType="String" syncable="YES"/>
<attribute name="orderNum" attributeType="Integer 16" defaultValueString="0" syncable="YES"/>
<attribute name="question" attributeType="String" syncable="YES"/>
</entity>
<entity name="Ingredient" representedClassName="Ingredient" syncable="YES">
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="recipe" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="Recipe" inverseName="ingredients" inverseEntity="Recipe" syncable="YES"/>
</entity>
4

1 回答 1

0

唯一的方法是编写一个解析xml数据并生成java类文件的脚本。这不是不可能,但有点复杂。但我认为这可能是一个非常好的主意!

于 2014-03-05T09:19:06.890 回答