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, ...

Get Anyone Can Create an App now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.