Add Frameworks in Xcode 4

A lot has changed in Xcode 4. As I recently worked on implementing some web services, I needed to add the libxml2 library to my project.

Add a Framework

Frameworks are now managed under build phases for the application target

  1. Project: Choose the "Project Navigator" from the Jump Bar or choose the View > Navigators > Project menu item
  2. Target: Click on the target in the navigator panel (it is the top item signified by the Xcode icon)
  3. Build Phases: Click on the "Build Phases" in the tab control on the main window
  4. Libraries: Expand "Link Binary With Libraries" and click the "+" button to add a framework
  5. libxml: Use the search field to find libxml (I chose libxml2.2.7.3.dylib) and click the "Add" button

Make Headers Available

For a standard framework (like AddressBookUI.framework), I would be already done. But when working with C libraries (like libxml), I also need to make the headers available to my project.

  1. Build Settings: In the same place, choose the "Build Settings" tab control in the main window
  2. All Filter: Make sure the "All" filter is selected in the subnavigation (as opposed to "Basic"
  3. Search Path: Find and expand "Search Paths"
  4. Header Search Path: Find and expand "Header Search Paths" and click the "+" button for Debug
  5. libxml: Enter /usr/include/libxml2
  6. Release: Repeat the last two steps for Release