English 中文(简体)
How can I "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...).

最佳回答

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.
问题回答

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

Follow the below five steps to add a 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 the + button (Green arrow in below image).
  5. Select your framework from the list.

Framework

Here is the official Apple page.

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.

The frameworks directory is as follows 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

In Project:

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

Follow the screenshots:

Go to linked framework and libraries

Enter image description here

You are ready to go!

  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

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.

Xcode add a framework

Starting Xcode v11 you should use

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

[Xcode pre-v11. Embedded Binaries vs Linked Frameworks and Libraries]

[Xcode v11. 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]





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签