say
say

Reputation: 2655

How to store large amounts of data on iOS in a PhoneGap app?

What is the best option for storing large amounts of data locally (such as images) in a PhoneGap application on iOS?

I am also using jQuery, jQuery Mobile and backbone if that matters.

Upvotes: 1

Views: 2480

Answers (4)

DeadPassive
DeadPassive

Reputation: 887

You can use the File api to store images and text files to the local filesystem. It works absolutely fine.

http://docs.phonegap.com/en/1.0.0/phonegap_file_file.md.html

Upvotes: 0

Louis B.
Louis B.

Reputation: 2368

If you can somehow transform your images to base64 (I download them from my server like that), you could also save them using PhoneGap's storage API. This works quite nicely from my own experience.

Keep in mind however that there is/was a nasty bug in Mobile Safari that would crash it completely when you load a lot of images into the view. Not sure if this has been fixed since.

Upvotes: 1

sciritai
sciritai

Reputation: 3758

You have a few options. How big is large? If it's about 2-3 megs, then localStorage is an option. The max size for most implementation is 5MB and this is shared amongst websites.

On the native side, you have NSUserDefaults and CoreData. Either one you use, you'll need to create a plugin for interfacing to the native side.

Upvotes: 0

ghostCoder
ghostCoder

Reputation: 7655

make a phonegap plugin, and write to a file on the ios filesystem with phonegap plugin mechanism
how

Upvotes: 1

Related Questions