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:
- Import it into your project
- 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:
Here it is the MediaPlayer framework, so MediaPlayer is the “directory” and MPMoviePlayerController.h is the header file you want to import.