Upload sqlite file to provisioned iPhone?
I have successfully dow开发者_如何学JAVAnloaded an sqlite datafile from my testing app on my provisioned iPhone using the Xcode organizer. How might I upload an sqlite file to the iphone to replace the data store that I am using in my app?
You can't upload a file after installation in the same way that you can download it in the Organizer.
If you want to get a data file into the app, add it to your project's resources and rebuild.
I recently discovered the answer to this question: You can just include the relevant SQLite file in your app bundle, and copy the file onto the location of the actual SQLite file which Core Data uses for its data store.
If you want to change the contents of a file on your iPhone, you can use the Organizer to Upload the file from your Mac to your iPhone. First use the Organizer to download the file from your iPhone to your Mac by clicking Download. Copy the file you want upload from your Mac to your iPhone into the <...>.xcappdata/AppData/Documents/ directory. Next click Upload. Then restart your app to read in the contents of the updated file. That's it!
精彩评论