User Tools

Site Tools



Frameworks are collections of code written by someone else you can easily include in your project.

There are two types: Cocoa frameworks (iOS frameworks) and 3rd-party frameworks (aka vendor frameworks). Anyone can compile their iOS code into a framework and expose it to other developers without passing around their source code.

The act of including a framework into your project is known as linking to it (alternatively, linking against).

The steps are as follows, assuming you are trying to link to the MapKit framework:

  1. Click the blue project file at the top of the project navigator
  2. Select “Build Phases” on top of the screen
  3. Click arrow next to “Link Binary With Libraries”, press plus button
  4. Search for the framework name, select and press add

Including third-party frameworks is a little more simple; you can usually just drag them into the frameworks folder.

Note that some frameworks, notably those that expose new, custom objects to the project, also require you to import the framework headers. To follow the example above, the import statement is:

#import <MapKit/MapKit.h>

and must be placed in any classes that manipulate MapKit classes. Note the chevrons (<>) instead of the usual quotes (“”).

ios-labs-s14/advanced-frameworks.txt · Last modified: 2014/02/24 12:40 by mbarboi