简体   繁体   中英

How to migrate an existing Appcelerator Titanium app database to a native Swift iOS app

I'm about to rebuild an application originally written in Appcelerator's Titanium into a fully native iOS app written in Swift.

The app relies heavily on the SQLite database created using Titanium Alloy Models, whereby users save items into their local database on their phone. I need this data to be accessible when the user updates their app with the newly rebuilt version.

Here are my questions:

  • Will the database be carried over when the app gets updated?
  • Can I access the database with the new Swift app?
  • Can I still create models in the new swift app for the database items?
  • If I create models in Swift, will they override the tables I created in Titanium? Will the user's data get lost?
  • Are there a set of best practices for this?

Please note I need to achieve this in Swift - not Objective C

Note, what I'm doing is basically the reverse of this question: Titanium - Retrieving SQLite Data from previous version of iOS App

Unless you tell it otherwise, Alloy will generate a _alloy_ database at the location documented under Ti.Database.open() .

Unless you specify an idAttribute in your model adapter config, Alloy will create an alloy_id UNIQUE TEXT column to store the unique guid for each model.

Apart from that, it's a plain old SQLite database that you can access from Swift.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM