Importing a Framework

Commonly when working with the iPhone SDK we run into a situation where the specific library we need is in a precompiled framework. These frameworks are libraries: collections of functionality thrown together into one package.

Using a framework is easy:

  1. Import it into your project
  2. Import the specific header file into your code

To start off right-click on the “Frameworks” folder in XCode and select Add->Existing Frameworks…

The frameworks for iPhone development are stored in: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/System/Library/Frameworks (where iPhoneOS2.2.sdk can be substituted for the appropriate operating system version) so navigate here and select the framework that you are interested in. For our purposes here we’ll assume that it is MediaPlayer.framework.

After that is loaded select which header file you want (we’ll assume it is MPMoviePlayerController.h) and import it using angle-bracket notation, using the framework as the path:

#import <MediaPlayer/MPMoviePlayerController.h>

Here it is the MediaPlayer framework, so MediaPlayer is the “directory” and MPMoviePlayerController.h is the header file you want to import.

This entry was posted in Uncategorized. Bookmark the permalink.

Error: The ad management script is not properly configured for this user

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>