views:

20

answers:

1

This one Also Resolved by myself. Good answer would be, New Edition App: make change the sqlite file name. check file exist, get the old edition app sqlite name value then remove, and add into that folder. this is the best answer.

*New efficient answer

STEP 1:  select .xcdatamodel file
STEP 2:  Xcode -> Design -> Data Model -> Add Model Version
STEP 3:  Manipulate new changes

For more detail about migrate or re-organize data model structure, visit Apple <here>

Although I didn't quiet sure how to add model version before reading Apple's document, My old way is still works.

Old resolved self answer

Example from 'Reciepe' given by apple, it don't replace the file if it is there already. However, if your code need to update and get rid of old .SQL file then the explicit condition needed for check the old file sqlite name deleting function required for update. Basic sequence would be,

CHECK 1: check if old file exist.
CHECK 2: if it does, remove it.
CHECK 3: then copy new one.
CHECK 4: if the old file don't exist,
CHECK 5: (if the new file don't exist),
CHECK 6: copy new file into that folder.
CHECK 7: if new file exist do nothing.

solved.

Original Posted Question

So I have completed my code work. This is first time releasing the app through iTuneStore. Current state of reading Core Data (.sqlite) file is already prefetched (already has information like apple's 'Reciepie' program).

Assuming I have successfully released through apple store, and decide to update my application to existing users.

Say I have sqlite contents but it contains bit more information than previous SQLite file under same structure.

Question 1. Every time update held to the existing user, does it removes previous ones and move new updated application?

Question 2. if it is not, then HOW can I append the existing sql value?

A: 

If you do not change the underlying data model, then the answers are:

1) updating from, say v1.0 to v1.1 does not remove the previous contents already stored and managed by Core Data.

2) Simply check the version of your application using the main bundle, and, if the version retrieved needs additional data to be inserted, do the insert. You can do the check and the insertion in

- (void)applicationDidFinishLaunching:(UIApplication *)application;
unforgiven