iPhone Simulating App Update at home before going out in the big bad world - iphone

this is a follow on from this question and the link given it seems that when an app is updated all of the files in the documents directory are copied into the updated apps documents directory and also anything in Library/Preferences. Whats the best way to simulate this for testing purposes?
Just copy the files in ApplicationSupport/iPhone Simulator etc? or has anyone developped any funky techniques for testing this.

I have created .sqlite file in my application's documents folder and created some dummy entries in my database table.
Now just change you code build new application without changing any of the certificate and profile information load the new application.
Now check for the old database table records. It will be definitely preserve under your Document directory in .sqlite file.
This is what i followed when i want to check it for same thing.
If anyone know better way then please feel free to suggest new things.
Jim.

Related

iphone any interface to deal with sqlite database created in the application Documents folder?

do we have any command line from where i can query the sqlite database, which is created by coding, and stored in the application's default Documents folder?
Turn on file sharing for the app, copy the database file to your Mac, and use the command line tools (sqlite3) that are there.
(Note to the previous editor: I appreciate editing of answers for accuracy, format improvements, and fixing typos...but, if you want to provide completely different information, I suggest providing your own answer instead of changing the meaning of another user's response.)

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.

How to create sqlite database within bundle during iPhone runtime?

I've tried using sqlite3_open statement, but the database is created at root level of my hard disk.
I can actually try to copy it to the bundle document folder. But,
Where will the database created if I execute it during the iPhone runtime? (Since I use iOS Simulator, it is created on root level).
How to create the database at the documents folder level immediately?
I'm sorry if I can't make myself clear enough, I'm really new working with database and stuffs.
Thank you for your attention.
You can not write to the main bundle, because it is signed with SSL certificate. But you can write to the document directory. Have a look at this link of how to create database at runtime in documents directory - create sqlite db programmatically in iphone sdk
You should create database file template with no content, but with structure, that you plan to use in your app. Add this template to your project Resources folder. Then, when app started, copy that file to Documents folder and use it.

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.

Copying iPhone CoreData files from one project to another

I'm trying create 2 apps, one that builds a persistent store, and another one that consumes it.
So far I have built one app that uses CoreData to successfully build a database from an XML file. So this project contains the data model, the .h/.m files for the entities, etc.
I'm now trying to enable the second app to read that .sqlite file by copying the data model file, the .h/.m files related to the entities and the sqlite file to that project (via add existing).
The code executes but always fails to find any objects in the database.
Are there any restrictions or correct steps to take when trying to copy over these files?
The solution here is deceptively simple.
Just copy your .xcdatamodel file from one project to another and then when you run your app in the simulator for the first time it'll create a Documents folder for the app. Just drop your saved .sqlite or .binary files into the yourApp/Documents directory on the device.
You can find the simulator directory in "~user/Library/Application Support/iPhone Simulator".
You can also download, edit, and upload the myApp directory on a provisioned iPhone by dragging and dropping into and out of the Organizer. Look at the Applications list.
The iPhone doesn't support xml stores with core data, only sqlite or atomic (binary). The sqlite store is by far the better option for most applications since it doesn't all have to be loaded into memory at runtime.
Is this what you meant?
I think (not 100 percent sure) in your app plist, if you set your application bundle name to the same thing, they will share resources because the device will think they are the same application...
I don't think this is going to work the way that you want it to. On the iPhone, each application runs in its own "sandbox", and it's not really possible for one application to write files that another can read.
Is it really two different projects, or is it two targets in the same project? That would seem to make a lot more sense, and then you can share entity objects as they change.
For copying core data files from one project to another, I first created a new project with core data support and then I opened the contents of the previous coredata file and except the root tag, pasted all child tags in the new core data file in new project.
Previousy I tried to delete the coredata file in new project, copy pasted the previous one and changed its name and it was not working.