Updated app has saved the original data - iphone

What is the trick that some apps after update keep original data saved before update for example scores or settings. I would like to use it with pList, but have not found how yet.
tnx

There's no trick. Anything you save to user defaults or your app's documents directory will be preserved in an update.

Just save it to a file in your "Documents" folder, or use NSUserPreferences.
Both are retained across updates.

I would expect NSUserDefaults to handle it correctly, but I could be wrong.

Related

My recently posted app update doesn't have latest/correct values in the info.plist file

I have a part in my info.plist file that stores a key metric that the app uses to know how many db's it can expect to load. It is a simple number that I change as needed. For some reason, when the app updates from the App Store with new values, it is as if the updated plist values aren't there. The app is working based on the old values.
But if I remove the application completely, and then reinstall from the App Store, it works! What am I missing here? Why wouldn't the plist file be updating correctly with an update? Is there some sort of manual copy/update process I should be doing to the Documents directory or something?
Can you write code of how you are accessing data from info.plist.
Also, remember when you are storing any data in documents directory, it will not update until you make it forcefully.
And info.plist always gets update once you update you build.
Hope it helps....

Is iCloud only meant for UIDocument and CoreData(How to Take Back up of any folder with its data on iCloud)

I read the apple documentation and some other links and found there are examples of using iCloud with only either UIDocument or Core Data.
I am having a folder created in documents directory named "backUPFolder" and it contains some images and other files in it.
I want to ask , if it is possible to move this backUPFolder in iCloud with all the data exist in this folder as it is.
If yes it is possible please provide me some useful link or suggest an approach which I can follow.
My requirement is to take a back up of my data on iCloud.
Please please help me.
I am stuck here.
Any suggestions would be highly appreciated.
Thanks in advance!
I have also only seen the UIDocument and Core Data examples. What comes to mind is to transform your pics and docs into Core Data blobs and store them with core data anyway. This could also be very efficient.
Alternatively, you could check out the Dropbox APIs.
If your folder in the Documents or Library folder of your application, it will be backed up to iCloud automatically assuming the user has iCloud enabled (and that you haven't explicitly flagged the file as NSURLIsExcludedFromBackupKey).
Any manual interaction with iCloud as a developer is typically to share files explicitly between installations of your app. If your requirement is just to back up data, you don't need to do anything besides store the folder in Documents.

Saving profile in Iphone

In my app, I am writing some data, and I want to save it so that I can retrieve it later. How can I save it and where will it be saved?
Please suggest some ideas...
I think you want to store it in a database using Core Data. If you give more specifics I may be able to give a more specific answer.
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html
NSUserDefaults would be the obvious suggestion.
Other suggestions would be to write it to a .plist file in the documents directory or use core-data depending on how much you would want to save.

Where is the SQL persistent store created by CoreData?

Can someone help me find where CoreData is storing the SQL file it creates in iOS applications?
So far I've tried "Show package contents" on the .xcdatamodel file and also the .xcodeproj file...No dice!
Is there an editor for looking at the contents of these SQL files?
Cheers.
-A
The url parameter of [NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:url:options:error] specifies the location of the file. Find this call in your code and see where you've stored it. XCode templates will put it into the top of your application documents directory, but you can put it anywhere you like.
Note that Apple considers the contents of this database to be opaque and non-user-modifiable. Playing with the data in your store is likely to cause issues with Core Data.
It's typically saved into your application's documents directory, with the name of your data model.
So, for example, if my data model is called AppData.xcdatamodeld, it will be AppData.sqlite inside my app's document directory. You shouldn't really need to touch the .sqlite file though.
Hope that helps!
Core Data editor --> http://christian-kienle.de/CoreDataEditor/

iPhone - persistent store coming from bundle

The Xcode templates for the creation of core data apps start a new blank sqlite file when the app is started the first time. But suppose I have a database already created that I need to include in the bundle, so, when the app starts the first time it already starts with a populated database.
How should I proceed. Ok, I know that I cannot write the database in the bundle, so I have to copy it to the document's directory. I see this is where the sqlite database created by the app itself is already on. So, that's it? I just overwrite the original file with the one in the bundle at the end of my RootViewController's viewDidLoad method?
If this is the way to go, then I need to build a control method that does that just the first time, right?
It must be a simpler way...
Any ideas?
thanks
You're on the right track with copying the .sqlite file from the application bundle to the documents directory. I used the approach outlined very thoroughly in this blog post by Jeff LaMarche. It deals specifically with providing staring data to an iPhone application, and it worked like a charm in my app.