I have database dump and I want load it to sqlite database on iphone at runtime. How i can do it from code?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is unclear what “database dump” is, but assuming it is a sqlite database that matches the data model on the iPhone it is easy–but with a trick Xcode throws in.
1) Rename the file from xxx.sqlite to xxx.bin. Other extensions should also work but if you leave it .sqlite Xcode will make changes in the file and it will not match the data model and crash. This little feature of Xcode cost me 1/2 a day.
2) Copy the database to the resources folder in Xcode.
3) On launch copy the database to the Documents directory renaming the extension to “sqlite”.