1

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.

say
  • 2,585
  • 7
  • 35
  • 48

4 Answers4

1

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

ghostCoder
  • 1
  • 9
  • 49
  • 72
  • 1
    Just curious - doesn't PhoneGap support the File API on iOS? Why do you need a native plugin for this? – lexicore Feb 03 '12 at 23:23
1

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.

Community
  • 1
  • 1
Louis B.
  • 2,348
  • 1
  • 29
  • 51
  • Thanks. I should be able to convert them to base64. I couldn't find a storage limit on the storage API, do you know if there is one? Also, do you know how this differs from something like Lawnchair? – say Feb 03 '12 at 18:55
0

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

DeadPassive
  • 877
  • 3
  • 8
  • 22
0

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.

sciritai
  • 3,688
  • 1
  • 17
  • 22
  • 1
    There is already a (very?) rudimentary plugin for NSUserDefaults on GitHub: https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/ApplicationPreferences – Devgeeks Feb 03 '12 at 01:00