O'Reilly logo

Beginning iPhone® SDK Programming with Objective-C® by Wei-Meng Lee

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 13. File Handling

WHAT YOU WILL LEARN IN THIS CHAPTER

  • Where your applications are stored on the iPhone

  • The various folders within your Applications folder

  • How to read and write to files in the Documents and tmp folders

  • How to use a property to store structured data

  • How to programmatically retrieve values stored in a property list

  • How to modify the values retrieved from a property list and save the changes to a file

All the applications you have developed up to this point are pretty straightforward — the application starts, performs something interesting, and ends. In Chapter 11, you saw how you can make use of the application settings feature to save the preferences of your application to a central location managed by the Settings application. Sometimes, however, you simply need to save some data to your application's folder for use later. For example, rather than keep files you download from a remote server in memory, a better (and more effective and memory efficient) method might be to save them in a file so that you can use them later (maybe even after the application has shut down and restarted).

In this chapter, you learn more about how you can persist data in your application so that you can use it later, even after the application has restarted. You learn the two available approaches: saving the data as files and as a property list.

UNDERSTANDING THE APPLICATION FOLDERS

So far, you have been busy deploying your applications onto the iPhone Simulator and have not spent much ...

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