14.0. Introduction

iOS is based on OS X, which itself is based on the Unix operating system. In iOS, the operating system’s full directory structure is not visible to an app because each app, written by an iOS app developer, lives in its own sandbox. A sandbox environment is exactly what it sounds like: a sanctioned area where only the app that owns the sandbox can access the contents of the folder. Every app has its own sandbox folder and the sandbox folders by default have subfolders that apps can access.

When an iOS app is installed on the device, the folder structure shown in Figure 14-1 will be created for that app by the system.

Name.app

Despite the odd name with the .app extension, this is a folder. The contents of your main bundle will all go in here. For instance, all your app icons, your app binary, your different branding images, fonts, sounds, etc., will all be placed in this folder automatically when iOS installs your app on a device. The name is the product name that you have set for your app. So if your app is called MyApp, the .app folder will be called MyApp.app.

Documents/

This folder is the destination for all user-created content. Content that your app has populated, downloaded, or created should not be stored in this folder.

Library/

You use this directory to store cached files, user preferences, and so on. Usually, this folder on its own will not have any files sitting in it. It contains other folders that will contain files.

Figure 14-1. Depiction of the iOS filesystem ...

Get iOS 7 Programming Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.