I have a website with mySQL database, parts of which I'd like to reuse in my iPhone app by populating CoreData DB (basically iPhone app is going to be an offline version of the website).
I am thinking of writing scripts which will translate mySQL into SQLite and then somehow feed the data into CoreData.
How would you accomplish this task?
Solution
Check out the following tutorial:
http://www.raywenderlich.com/980/core-data-tutorial-how-to-preloadimport-existing-data
TL;DR - uses a python script to write to the SQLite database in a Core Data compatible format.
Possible Drawbacks
Alternative
I'd dump the mySQL database to a CSV file, model the Core Data store in Xcode as unusual and write a quick and dirty importer within the application itself.
You could use cCSVParse to do the CSV heavy lifting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With