1451
votes

I can't find the good old "Add existing frameworks" option. How do I do this?

We're talking about Xcode 4 DP2 (in the context of iPhone development, as far as it matters...).

11
I can't believe that: a. there's a (integrated, none the less) IDE+SDK out there in 2012 that still doesn't make clear how to add one of the bundled frameworks to a project. b. such a (normally) trivial subject got so much attention. c. the solution in so convoluted.Shivan Dragon
I kept right-clicking the Frameworks folder in my project figuring there should be a contextual menu item there for this; there isn't, and xcode, somewhat like the over-extended iTunes app, is often not consistent, logical or intuitive. Sadly, with my xCode version (4.4), using help menu search crashed the app just as the relevant help page came up. I'm one update behind the latest xCode release, but switching horses with an overdue deadline seems like a bad idea (even though I hope they fixed the "help" crashing in the update)wkw

11 Answers

1735
votes

As per Apple's documentation:

  1. In the project navigator, select your project.
  2. Select your target.
  3. Select the "Build Phases" tab.
  4. Open "Link Binaries With Libraries" expander.
  5. Click the + button.
  6. Select your framework.
  7. (optional) Drag and drop the added framework to the "Frameworks" group.
40
votes

I just added the existing framework folder manually into the project navigator. Worked for me.

24
votes

I would like to point out that if you can't find "Link Binaries With Libraries" in your build phases tab click the "Add build phase" button in the lower right corner.

19
votes

Follow below 5 steps to add framework in your project.

  1. Click on Project Navigator.
  2. Select Targets (Black arrow in the below image).
  3. Select Build phases ( Blue arrow in the below image).
  4. Click on + Button (Green arrow in below image).
  5. Select your framework from list.

Framework

Here is the official Apple Link

15
votes

Another easy way to do it so that it is referenced in the project folder you want, like "Frameworks", is to:

  1. Select "Show the Project navigator"
  2. Right-click on the project folder you wish to add the framework to.
  3. Select 'Add Files to "YourProjectName"'
  4. Browse to the framework - generally under /Developer/SDKs/MacOSXversion.sdk/System/Library/Frameworks
  5. Select the one you want.
  6. Select "Add"

It will appear in both the project navigator where you want it, as well as in the "Link Binary With Libraries" area of the "Build Phases" pane of your target.

10
votes

The frameworks directory is as follow in my computer: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks

not the directory

/Developer/SDKs/MacOSXversion.sdk/System/Library/Frameworks
7
votes

In Project

  1. Select the project navigator
  2. Click on Build Phases
  3. Click on link binary with libraries
  4. Click on + Button and add your Frameworks
5
votes

Follow the screen shots

Go to linked framework and libraries

enter image description here

you are ready to Go!

2
votes
  1. In the project navigator, select your project.

  2. Select your target.

  3. Select the "Build Phases" tab.

  4. expander. Click the + button.

  5. Select your framework.

  6. (optional) Drag and drop the added framework to the "Frameworks" group.

    enter image description here

1
votes

Xcode 12

Just drag it into the Frameworks, Libraries, and Embedded Content of the General section of the Target:

enter image description here Done!

Note that Xcode 11 and 10 have a very similar flow too.

0
votes

Starting Xcode v11 you should use

<Project settings> -> <App Target> -> Frameworks, Libraries, and Embedded Content
//or
<Project settings> -> <Framework Target> -> Frameworks and Libraries

[Frameworks, Libraries, and Embedded Content plus Frameworks and Libraries with Embed vs Do Not Embed]

Also do not forget to check Library Search Paths or Framework Search Paths. I would recommend you to use drag-and-drop[About]

[Step-by-step examples here]