Re: Core Data Initialization
Re: Core Data Initialization
- Subject: Re: Core Data Initialization
- From: Dave <email@hidden>
- Date: Wed, 04 Sep 2013 12:33:09 +0100
On 4 Sep 2013, at 12:13, Willeke <email@hidden> wrote:
>
> Op 2 sep 2013, om 13:01 heeft Dave het volgende geschreven:
>
>> Is this advisable?
>
> Yes, it's in the Core Data FAQ: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreData/Articles/cdFAQ.html#//apple_ref/doc/uid/TP40001802-SW5
It doesn't actually say use an Core Data SQLite file, it says use a persistent store which may or may not be the same thing. Using an SQLite file that has been created using an older version of the app is really dodgy for a number of reasons:
You have to manually copy the data out of an app from the simulator or a device into your project structure. If you don't do this, if the Model Changes, it may well crash on a clean install. This will be largely hidden at the development stage.
It is better to use the same source as the real application will use to build a fresh copy of the Store. In my case the live app uses JSON Server feeds to populate a Core Data Store. So, in this case all I have to do is hold local copies of the JSON files, and on a clean install (the first time the app is launched), change the URL to point to the local files, instead of the usual Server URL.
This not only gets the job done safely, but tests your parser and other app components locally. Also you could use test versions of these files to hold known data which makes testing a lot easier in general.
All the Best
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden