Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subdirectories within an iOS application

Tags:

iphone

bundle

Is there a way to have directories within an .app?

At the moment if I add a file into Xcode, regardless of what Group hierarchy it is in, the file always lands in a flat filesystem within my application bundle.

like image 437
gak Avatar asked Jan 06 '09 23:01

gak


People also ask

How do I create sub folders on my iPhone?

To make a folder, drag an app onto another app. To rename the folder, tap the name field or the Close button , then enter the new name. Drag apps into the folder. Folders can have more than one page.

What is a subdirectory in OS?

In a computer file system, a subdirectory is a directory that is contained another directory, called a parent directory. A parent directory may have multiple subdirectories.

What is the purpose of subdirectories?

A subfolder is a folder stored inside another folder. Subfolders help you organize your files more completely. Each subfolder should be used to store files related to each other. For example, you might have one folder for files related to a job search.


2 Answers

If you just want to copy existing files into your application bundle's Resources folder (which on iPhone is just the inside of the .app bundle), do the following:

  • Drag the folder you want copied into the Files and Folders listing of your xcode project.
  • From the sheet that pops up asking you if you want to add the files to a target, change the radio button to "Create folder references for any added folders'.

The folder you dragged in and all of its contents will be copied verbatim during building.

like image 85
Jason Harris Avatar answered Oct 09 '22 03:10

Jason Harris


Under the target for your application, you have to add a Copy Files phase. Then you can specify a sub-directory within the app bundle that you want the file copied to. There will be a bunch of default directories for specific things (like resources and frameworks and such), but you can choose any directory you want. When your application bundle is built, the files you specify will be copied to the location within your bundle.

like image 17
Jason Coco Avatar answered Oct 09 '22 02:10

Jason Coco