Hello,

I have an existing iOS app which is available in the iTunes App Store which 
employs Core Data for persistence (SQLLite). I am overhauling the persistence 
model in the app, and so the big picture is that I need to migrate all data (if 
it exists) into the new persistence model (the specifics of the new model are 
unimportant). Because I have to handle both new users of the app, and users who 
have the app already, this breaks down to the following use case:

Determine if the user is a new user of the app, or an existing user of the app. 
I would assume the proper way to determine this is to detect if a Core Data 
database exsts (without creating one, of course). If it does exist, then the 
user is an existing user, and go to step 2. If it does not exist, then the user 
is a new user, go to step 4. 
This is an existing user, so load the Core Data database, read all data out, 
store in the new persistence model. 
Delete the existing Core Data database file from the filesystem.
Store some state value in NSUserDefaults indicating that the user is migrated / 
Core Data has been removed. 
For all subseqeunt app launches, check the NSUserDefaults for the state 
variable indicating no other checks need to be done. 
User the new persistence model. 

I have three questions about facilitating the above: 

How do I check for the presence of a Core Data database without actually 
instantiating / creating the database? 
After using an existing Core Data database, what is the proper way to 
completely unload it from memory and then delete the database file entirely? 
Is there a better way to going about accomplishing the above? 

Thanks, 

Brad
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to