iPhone app's Core Data, after upgrade to App Store? - iphone

I managed to finish upload my first iPhone app to Apple's App Store couple of days ago. My app is based on Core Data so it contains users' data to their devices.
What I want to know is that what happens when I upgrade the app with or without altering Core Data? (altering means add new entity or property, etc)
From my experience, I downloaded my own app from Apple's App Store and saved some data and then I install the same app from my computer using XCode with slight change to interface that has nothing to do with Core Data. When I turned on the app, the data is all there.
Is it safe to upload an upgraded version of iPhone's app to Apple's App Store assuming that as long as we don't touch Core Data, user's data would not be influenced?

If you change Core Data model, it may need to migrate/update its scheme. Apple has the appropriate documentation. The work necessary to perform a migration depends on what you change.

Related

How do I download an sqlite database from an app on my iPhone?

I made an iPhone app that allows data entry. Over the past month I have been using it and input a lot of data that is now only on my iPhone in the sqlite database used by the app. I want to get the data off my phone now and store it somewhere else.
Is there anyway to access the sqlite database on the iPhone? If so can this data be updated externally or would the database need to be "re-embedded" and copied back over to the iPhone at build?
Try the iPhone Backup Extractor.
http://www.iphonebackupextractor.com/
If it is a development version, you can download data in Xcode. Plug in your device and find it in the area you do provisioning. Look for your app icon and there's a download button.

Does a TestFlight upgrade break Core Data schemes in an app?

I've got an app that I'd like to send to beta testers using TestFlight.
We won't be changing the Core Data model, but I'm curious about two things:
When I send out an updated beta, is there any risk that the Core Data will be corrupted with the update?
When the app goes to the App Store, will our beta testers have to start fresh from the App Store version, or will their Core Data still appear in the App Store version?
The user's data is stored in their own documents directory. If you haven't changed the scheme (or if you have and you have a proper migration set up) then just updating the app will not affect their own data - unless they delete and install the application again.
If you haven't changed the bundle identifier - and they don't delete and re-install their app - the data will still exist in the Document directory.

Data lost when updating iPhone app to new universal version

I had recently created an universal app which was an iphone app only earlier, there were many version updates in that. I launched the universal app with next version that should be. But all the database data is lost when I update the old app to universal app.
Does anyone know how to avoid losing data during the upgrade?
When updating, the data is not erased (kept in the Documents directory), so there are chances that the reason of your data loss is in your code.

Core Data - submitting app store updates

Basically when I have an application in XCode and I change the sqlite/coredata database and try to run it on a device that already has the application on it then the app crashes. I have to remove the app and reinstall it.
I have updated the database on an app that has already been submitted to the app store. There has been about 100 downloads, and now I want to submit the update. Will people who have already downloaded it have problems with it? How would I make sure that they don't? There won't be any data in the old database that I will need to be honest, but I'm worried that the app just won't start at all.
Thanks
Tom
From your description I can tell that you've changed the Managed Object Model withtout changing the store version.
Check out this tutorial (may be Mac version, but it should be valid) here.
However, if you with to omit the migration (since you said users won't exactly have any data in the store) you can always change the store path so that it loads another store. However, if you plan any updates and further developement of the app then i strongly recomend to read about core data migration.
Yes the app will probably crash when running with old db.
Apple released an interesting documentation about Core Data versioning and migration called: Core Data Model Versioning and Data Migration Programming Guide
If you read this document, you will learn how to avoid the crashes with updated coredata databases.

Connecting CoreData to my App on an iPhone Device

I apologize ahead of time for what I'm sure is a complete newbie lapse. Running my iPhone app on iPhone simulator - no problem. But I loaded the app on an iPhone device for the first time and it appears as if the SQLite database I'm using (NSManagedObjectContext) isn't connected or didn't upload. The app installs but with no data. How do I get it all to upload and work on the device?
I appreciate any help.
lq
The first rule with Core Data is that you should never ever touch the store directly. It should be considered a black box and only accessed via the the Core Data APIs. Accessing the database directly is unsupported and can lead to data corruption.
What you should do instead is create a trivial desktop application (or command line is you are just importing from another source) and enter the data there. Once the data is entered then copy the sqlite file to your mobile application and include it in the bundle. That way you are accessing the file from Core Data. Since Apple can and does change the structure of that file without notice your application will be future proof.
update
If you have created a database using Core Data you can then take that sqlite file and add it to your Xcode project for your iPhone application. Xcode will then copy it into the app bundle when it compiles the project.
Looking a little deeper I found a link that answers my own question. So anyone with the same question, this solved the issue for me:
http://ablogontech.wordpress.com/2009/07/13/using-a-pre-populated-sqlite-database-with-core-data-on-iphone-os-3-0/