App Bundle in iPhone

App Bundle


When you build your iOS app, Xcode packages it as a bundle. A bundle is a directory in the file system that groups related resources together in one place. An iOS app bundle contains the app executable file and supporting resource files such as app icons, image files, and localized content.

From your code, access your app's resource files using an NSBundle object:

  1. Use the mainBundle method of NSBundle to obtain your app's main bundle object.

  2. Use the methods of the bundle object to obtain the location of the desired resource file.

  3. Open (or access) the file and use it.


    bundle-in-iphone.png

The pathForResource:ofType method is one of several NSBundle methods that you can use to retrieve the location of resource files in your bundle. The following example shows how to locate an image file called sun.png and create an image object. The first line gets the location of the file in the bundle. The second line creates the UIImage object using the data in the file at that location.


Apps-iPhone_Bundle-Identifier-in-iphone.jpg