ChatGPT解决这个技术问题 Extra ChatGPT

How to "add existing frameworks" in Xcode 4?

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...).

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.
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.
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)

6
6 revs, 5 users 37%

As per Apple's documentation:

In the project navigator, select your project. Select your target. Select the "Build Phases" tab. Open "Link Binaries With Libraries" expander. Click the + button. Select your framework. (optional) Drag and drop the added framework to the "Frameworks" group.


For me at least, if you move the framework into any of the groups after this, it stops working.
I just tried this with the latest build and didn't have any issues with moving the framework to the Frameworks group after it was added to the build.
They have made this so dumb... I think I kinda miss the old XCode... So many chnages... even some shortcuts dont work :P
@vivianaranha, me too missing the old Xcode... xcode 4 crashes most of the time for me..
Compare "right click, add, existing framework" to the above and yeah, no wonder people miss old Xcode. Why're they complicating stuff? baffled (+1 for answer, not that you need it with 131 +'es already but hey! :P)
T
Tom Wilke

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


Ok, I finally did it, as follows: 1) In the "project navigator", open the "frameworks" folder and select one the existing frameworks (e.g. UIKit.framework) 2) Right click and select "Show in Finder" from the menu 3) From the newly opened folder in the finder, drag the framework folder you are interested in (e.g. OpenGLES.framework) into the "frameworks" folder in XCode 4) Be sure not to "copy items into destination's group folder" 5) Choosing "Create groups for any added folders" seems to make it
H
Hemant Singh Rathore

Follow below 5 steps to add framework in your project.

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

https://i.stack.imgur.com/nByh4.png

Here is the official Apple Link


L
LinusGeffarth

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

Select "Show the Project navigator" Right-click on the project folder you wish to add the framework to. Select 'Add Files to "YourProjectName"' Browse to the framework - generally under /Developer/SDKs/MacOSXversion.sdk/System/Library/Frameworks Select the one you want. 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.


r
rml

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

Right - it depends on what you have installed. Also, the XCode 4.3 release causes them to be installed to a completely new location - under the XCode distribution path. On my two machines, it is: /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/SDKs/MacOSX10.7.sdk/system/Library/Frameworks
M
Mr.Kushwaha

In Project

Select the project navigator Click on Build Phases Click on link binary with libraries Click on + Button and add your Frameworks


T
Tunvir Rahman Tusher

Follow the screen shots

https://i.stack.imgur.com/tkekO.png

https://i.stack.imgur.com/ProxW.png

you are ready to Go!


S
SARATH SASI

In the project navigator, select your project. Select your target. Select the "Build Phases" tab. expander. Click the + button. Select your framework. (optional) Drag and drop the added framework to the "Frameworks" group.


M
Mojtaba Hosseini

Xcode 12

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

https://i.stack.imgur.com/r0wt8.png

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


y
yoAlex5

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]