What is the maximum size to store data - iphone

I am working an app which stores some large amount of data (hundreds of mbs) in application's own library.
can anyone tell me if there is any size limit for an app to store data?
I also want to know the good method to store my data.Currently i am using pList to store name of my data files and the actual files are stored under "Document/"..
Should i use Blob or any other suggestion ..?

Not so sure but you can have a look on it - Memory Management.

For saving large amounts of data you should probably look at Core Data or SQLite (a good source is Mobile Tuts, plist wouldn't be a good choice. And so far I don't really know if there is a limit but if the total amount of data saved in your app is over 500MB it would be very unresponsive, so maybe you should save it to a server or something.

Related

Document directory is good to store data or cache in objective c?

Friends i need to store more than 100 mb data which come in zip format and i get data after unzip this zip file and unzip data is more than 70 mb in size , so my question is that which storage location is good to keep this data, currently i am using cache but it gives memory warning on device when i writes data in cache and then after sometimes app gets crashed.
This zip file contain html pages and images.
i checked this link also but did't get answer to store thes html and images which comes in zip format from server.
Any small help will be highly appreciated.
Thanks in advance
Don't try to read this entire ZIP file into memory at once! It's not the permanent storage (Flash) on the device which goves you the memory warning, but you eat up the RAM. Yes, the Documents or Library directory is fine for storing your app data, just be careful with the memory management.
Like H2CO3 stated, the memory warning is indeed caused by reading it all into RAM in one chunk. Apart from that, be sure to follow Apple's guidelines regarding data storage. If the data being saved is temporary, be sure not to store it in your documents directory, otherwise your application might get rejected (Speaking from experience).

Any concept of iPhone Memory Store? memcache or redis for iPhone?

I'm looking for some concept of a memory store for my iPhone App. There are some complex NSDictionaries I want to store in memory and read from, rather than parse the JSON stored in a database over and over.
If there is no such thing as a memory store, what options do I have? I tried putting inside user defaults, and reading it back again, but it seems to take just as long as the JSON parsing...
I decided to create a singleton class that contains the data I needed and it's being used by the entire app. Easy, simple and gets the job done
Storing in a binary plist in persistent memory is faster than an xml plist.
Use the NSPropertyListBinaryFormat_v1_0 option with NSPropertyListSerialization.

Caching data on the iphone. Max size of stored data

I was discussing the requirements of an app and I am a little lost with a few things.
1)
I will be getting data back from a web server via JSON. The user wants the data cached for a month so that there is no unnecessary data usage. My concern is that the data base on the webserver is about 300mb in size. If the user is very active this could mean there could be a lot of data cached on the phone. Is there a limit to the amount of storage you can use? Would 50mb of cached data be realistic to store?
2)
If i was to store all this data, what would be the best way to handle it? Since i would need to be able to search and manage the data from the device. Is this a realistic request from the client, or is the iphone really not suited to this kind of operation. Would it be best to not cache the data at all and just pull it down with JSON as required.
Many Thanks,
-Code
You can use CoreData framework with SQLite for storage.
According to the accepted answer to this question, there is no specific limit to how much data you can store other than the device's flash storage size.
Is there a limit to the amount of storage you can use? Would 50mb of cached data be realistic to store?
No, there is no limit except the capacity of the iPhone's flash memory. 50 MB is not that much IMO, considering there are apps that are hundreds of megabytes large.

Using DB or XML Parsing for an iPhone App?

For a products catalogue app on iphone which approach is more efficient? Using sqllite db or directly parsing online from xml without db?
Small amounts of data can be loaded as XML directly into memory. Thus, XML would do just fine. When using a large amount of data, a database would be a better option, but it will decrease speed simply because it needs to read/write the data to storage.With iPhone apps and other mobile phone apps, the difference between memory and storage tends to be very small. Unfortunately, for an app to understand an XML file, it must load the XML in a DOM model. This will eat up additional memory of about the size of the XML. Thus XML is not suitable for large amounts of data. (Or huge records.)
If you have up to 50 products, the balance is in favor for XML. Over 50 and you're better off with sqllite.
An added bonus of XML is that you need to explicitly save back to storage to update your changes. With databases, any updates to the data tends to be done directly. Thus, with a database you have a bit more problems undoing any errors. However, with XML your changes will be lost if your application crashes. Personally, I prefer it to only update data explicitly on my command, thus I would prefer XML. (But not for large amounts of data.)
Add your products to sqllite and update only changed/newly added products to the db at every launch asynchronously.
Render your View from the data in DB.

iPhone long plist

I have some data i want to add in to my app...about 650 categories (includes a name + id number), each with an average of 85 items (each with a name/id number).
Will the iPhone support such a large plist? I want to first display the categories in a UITableView, when a category is selected I want to display all of the associated items. Having such a large plist, im not sure if the iPhone will lag when loading the items. At over 51,000 lines it seems like...it might.
EDIT: The raw text file is 2MB
A plist can be of arbitrary length. But a plist with 2 MB of text data is a really bad idea. Even on the desktop, Apple only recommends plists with a maximum size of a couple hundred KB:
http://developer.apple.com/mac/library/documentation/cocoa/conceptual/propertylists/AboutPropertyLists/AboutPropertyLists.html#//apple_ref/doc/uid/10000048i-CH3-54402
The reason is plists must be deserialized entirely into memory before you can access a single element from the plist. This is convenient for small plists, but extraordinarily inefficient in space and time for large plists.
You should be loading your data into a database. If you do it properly, a database will only bring in the portion of the data set you need, rather than the entire data set.
I suspect it would probably take a while to load your plist, especially if you are using an XML based plist. A binary plist may be faster. You may want to consider using CoreData or a raw sqlite database to store your data instead.
The only way to be sure is to try it and see. Nothing beats actual performance timings.
That really seems better suited to pre-loading a database with. It should be somewhat smaller for one thing...
The technique is, write code to read the plist and put it in SQLlite or CoreData. Then take the database out of the simulator directory, and add it to your app - on app launch read the database from the file you have in the project.
If you need to modify the data, preload it but first copy the database into the writable directory on first launch (or basically anytime it is not there).