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

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 ..

Related

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

iOS how to manage photos

I'm creating an iOS app that works with photos.
I have built apps that do similar things on Android, and know of some of the pains that images can bring with regard to storage and memory management.
Here are my questions:
How do I save a picture that I've taken & where do I save it to (is it sensible to save it with core data somehow?)?
How do I load a picture from wherever I've saved it to?
For a tableview with images, do I need some form of lazy loading (you do on Android), if so, can anybody recommend a tutorial or library?
How do I save a picture that I've taken & where do I save it to (is it sensible to save it with core data somehow?)?
Use the system imagepicker/taker UIImagePickerController and no dont store images in CoreData. As a general rule store them in the system photo library. Store the Asset Library URL as a reference.
Images can be stored in your App documents folder also.
How do I load a picture from wherever I've saved it to?
Use the API in the AssetsLibrary framework to retrieve pictures from the system store.
For a tableview with images, do I need some form of lazy loading (you do on Android), if so, can anybody recommend a tutorial or library?
No. Lazy loading is done for free by your UITableViewController implementation. There are a 1001 great UITableView tutorials on the web.

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.

iOS: migration form plist to SQLite data store

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.