Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to save data on the iPhone

I am writing an iPhone application, and need to save the state of my application (5K or so).

My main worry is data persisting across upgrades. Some of the applications I use clearly got this wrong, and I would prefer not to!

like image 977
Chris Jefferson Avatar asked Nov 20 '08 23:11

Chris Jefferson


People also ask

What uses most data on iPhone?

Streaming video and music typically use the most mobile data in the shortest amount of time. It's important, therefore, to limit your use of video streaming apps like YouTube, TikTok, and Netflix when you're on Wi-Fi.

What causes high data usage on iPhone?

Play Low-quality Music and Videos. Playing high quality music and videos consumes a large amount of data. Maybe that is why is Facebook using so much data on my iPhone. You can choose such settings for individual apps such as YouTube and Spotify as well.


1 Answers

To save state, NSUserDefaults is the way to go. I believe most, if not all, instances of application data being deleted after an upgrade are due to issues on the AppStore. They may be related to data-format changes, but if you use just NSUserDefaults and standard plist-storable objects (NSString, NSDictionary, NSNumber, NSArray, NSNumber, and primitives), you should be safe.

like image 69
Ben Gottlieb Avatar answered Oct 02 '22 19:10

Ben Gottlieb