iOS: migration form plist to SQLite data store - iphone

I'm using the plist for storing data in iphone application, but now there is a need to upgrade to more powerful data warehouse. Can I upgrade the application to implement migration from plist to sqllite without losing data? Thank you.

Probably.
When your app launches, if it doesn't have a database file (because it's the first time being run with updated app), read in the plist data, and write it out to your new database file.
You will have to handle translating between the format of the plist and the structure of your database.

Related

What is the best approch to save images and xml file in device (sqliteDB)

I am creating an iPhone application in which i have to store images and xml files locally in device (sqliteDB). So my question is what is the best way to do this?
I have two approaches in my mind.
1) Store images and xml in device and just save references of them in to sqliteDB.
2) Encode images and xml file to Base64 and save to sqliteDB directly.
Which will be more wise and why?
Do anyone have any other way to perform this by which application can run smoothly.
you can store both xml and images in (sqllite) i think it is best because we can perform CRUD operations .
Saving and retrieving images to and from SQLite in iOS
you can find how to save images in sqllite
http://mobile.tutsplus.com/tutorials/iphone/iphone-sdk_store-data/
above tutorial is about how to use sqllite in ios and save data in sqllite ,saving all these
data in sqllite is a wise way to manage the resources ..

Best way to store images in iOS

I was wondering if anyone could suggest the best way for me to store images for my app.
I want to be able to provide an XML update functionality that will allow the user to update their app with a new set of images. I was wondering what the best way to do this was as i need to read and write to the store location. Is storing them in a sqlite database the best way or am i able to use the filesystem to do this without the chance of the iPhone deleting any of the downloaded images?
Thanks
You can write to the filesystem, every app in iOS is sandboxed and has access to his own documents folder.
I would suggest to write on filesystem and only save the urls on the database as that is more performant than saving blobs on a database.
Apple has a good write up about the iOS filesystem.
Alternatively you could implement a solution using SQLite, Apple mentions it in the: Large Data Objects (BLOBs) section here:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html#//apple_ref/doc/uid/TP40003468-SW5

how to upload Sqlite database file to server from iphone application in ios

In my iphone application i used sqlite3 for creating database.
Now i want to take backup of a database file on my server.
so how to upload my sqlite db file to server from my application in iphone?
I would read the sql database into a JSON object, then upload it to a server via a URL that calls a PHP script along the lines of this stack overflow answer!
Here's an example of some mySQL data wrapped into JSON:
{database:{"col1":"56","col2":"85","col3":"some_text"},
{"col1":"57","col2":"86","col3":"next row"} }
More about JSON payloads in Apple dev docs here JSON
As of iOS5.x, Apple now includes some JSON helper classes, see NSJSONSerialization class reference along with the Twitter example app.
I have used this the SBJson framework in the past for iOS SBJson

how to store video file in sqlite database in iphone?

I want to capture videos in my application and this video should be stored in sqlite database.
pls tell me the code how can i do this?
thanx.
If you are trying save the entire video in database please avoid that approach,its entirely wrong .Save that videos in your document folder with some name and save that name in database. Your approach take so much memory

How can I save images to iphone directory and retrieve it?

I want to save image in iphone album and retrieve them on particular index, how can I?
I have to save profile of many people, along with their images, so how can I access such concept?
Do not save images in iPhone album if they're your application related only.
The better way is to create directory in your application documents directory and store them there. Or even better, do use CoreData and transient property to store image on your disk to keep your data well organized.
you also have choice to save the image in sqlite3 database and retrieve it when needed.