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
- Project: Choose the "Project Navigator" from the Jump Bar or choose the View > Navigators > Project menu item
- Target: Click on the target in the navigator panel (it is the top item signified by the Xcode icon)
- Build Phases: Click on the "Build Phases" in the tab control on the main window
- Libraries: Expand "Link Binary With Libraries" and click the "+" button to add a framework
- 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.
- Build Settings: In the same place, choose the "Build Settings" tab control in the main window
- All Filter: Make sure the "All" filter is selected in the subnavigation (as opposed to "Basic"
- Search Path: Find and expand "Search Paths"
- Header Search Path: Find and expand "Header Search Paths" and click the "+" button for Debug
- libxml: Enter /usr/include/libxml2
- Release: Repeat the last two steps for Release