O'Reilly logo

Objective-C Recipes: A Problem-Solution Approach by Matthew Campbell

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    4

File System

This chapter covers working with the file system on Mac and iOS.

The recipes in this chapter will show you how to:

  • Get a reference to the file manager
  • Reference key directories for Mac and iOS
  • Discover and change a file’s attributes
  • Get a listing of files in a given directory
  • Manage files and directories
  • Use delegation with file manager
  • Work with data using the NSData class
  • Manage caching objects that take up lots of memory

4.1 Referencing and Using the File Manager

Problem

You need to work with your app’s file system.

Solution

Get a reference to your app’s NSFileManager to work with the file system.

How It Works

NSFileManager is an Objective-C singleton object (see the note below for an explanation of singleton) ...

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