SUMMARY

This chapter demonstrated how to write a file to the file system of the iPhone and how to read it back. In addition, you saw how structured data can be represented using a property list and how you can programmatically work with a property list using a dictionary object. The next chapter shows you how to use databases to store more complex data.

EXERCISES

  1. Describe the uses of the various subfolders contained within an application's folder.
  2. What is the difference between the NSDictionary and NSMutableDictionary classes?
  3. Name the paths of the Documents and tmp folders on a real device.
  4. Name the class that provides in-app support for exporting documents from your application.
  5. What key should be set in order to allow file sharing support for your application?
  6. What key is used to register a new file type with iOS to inform it that your application is capable of handling it?

Answers to the exercises can be found in Appendix D.

imageWHAT YOU LEARNED IN THIS CHAPTER

TOPIC KEY CONCEPTS
Subdirectories in each of the applications folders Documents, Library, and tmp
Getting the path of the Documents folder
NSArray *paths =
NSSearchPathForDirectoriesInDomains(
  NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex:0];
Getting the path of the tmp directory
-(NSString *) tempPath{
return NSTemporaryDirectory();
}
Checking whether a file ...

Get Beginning iOS 5 Application Development 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.