O'Reilly logo

Anyone Can Create an App: Beginning iPhone and iPad programming by Wendy L. Wise

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 24. Saving LioNs

This chapter covers

  • Sandboxes
  • Saving LioN objects to a file
  • Loading LioN objects from a file
  • The NSCoding protocol

Now you have the ability to create new LioNs and edit them, but when you close the app and open it again, all of your data is gone. You can fix that, though, so let’s get to it. The purpose of this chapter is to save the lionData array to the iPhone so the data loads every time you load the app, and the data saves to the phone every time you close the app.

24.1. Playing in the sandbox

Saving data to your iOS device isn’t that different from saving a file to your computer. When you’re on the computer, you pick any location that you have access to and click Save. When you’re on an iPhone or iPad, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required