mano
mano

Reputation: 85

How to add framework to xcode

I am new to Xcode and want to add and use framework which I have taken from internet but
when I add it to my products folder by right clicking on products and using add new files it runs fine and when i use my project's project.app file on my mac or on any other mac it gives me dyld error that the bundle image not find. And when I use bundle image in my framework folder its give me ld error that bundle not found help please.

ld: framework not found SMS-Bundled
 Command /Developer/usr/bin/clang failed with exit code 1

*updated

when i add my framework to framework folder now its giving me error at run time...

    dyld: Library not loaded: @executable_path/../Frameworks/SMS-Bundled.framework/Versions/A/SMS-Bundled
  Referenced from: /Users/usman/Library/Developer/Xcode/DerivedData/Serial_Tools-detoutxzbnjrngcuulrbgcasxmjs/Build/Products/Debug/Serial Tools.app/Contents/MacOS/Serial Tools
  Reason: image not found

Upvotes: 1

Views: 4058

Answers (2)

Karthik
Karthik

Reputation: 88

In your project build setting, under "framework search paths" mention the path of the framework.

This will resolve your issue.

Upvotes: 0

Pochi
Pochi

Reputation: 13459

(In Finder)

Go to the folder where your custom framework is. copy the framework. Now go to your project's folder. Create a new folder called Frameworks, paste the custom framework inside this folder.

(In Xcode)

Drag the custom folder FROM finder to the Frameworks folder on the project explorer (where all the rest of the frameworks are)

Now select your project, go to Build Settings, scroll down to "Framework Search Paths" field, double click the value to open it, press the + to add a new path, write ./Frameworks as the new path.

From now on if you want to add other private/custom frameworks all you have to do is copy them into the created frameworks folder, and simply drag and drop it into the xcode frameworks folder. (You must drag it from the project framework folder in finder to the framework folder in xcode).

PD: You don't necessarily have to name this folder frameworks, it can be whatever, just make sure to change the Framework Search Paths accordingly.

Upvotes: 2

Related Questions