Add my own Framework to Target in same Project

I have developed my own framework. In the same Xcode project I have a target which is an iOS executable (app) that uses the framework.

What is the proper way to add and embed my framework in the target?


The only thing I have been able to get to work is when I provide paths to the temp build directory, you can see my lib is linked to

build/Debug-iphoneos
:

http://i.stack.imgur.com/frEO2.png


And I have to include the temp build directory in my Framework search paths, e.g.:

/XCode_Build/TDTPhotoLib-hiiogugjwmaajpcurftmlyveoies/Build/Products/Release-iphoneos


This just doesn't seem right the right way to set it up.

Replies

The proper way to do this is to click the + button under "Linked Frameworks and Libraries." You should see your private framework at the top of the list, in a special section, followed by all the system frameworks. You should not include it under both the embedded binaries section and the linked frameworks section (and the same goes for the GPUImage framework as well).


Now as for the search paths, it used to be that you had to do some manual configuration to get that to work, but I'm not sure that's necessary anymore. (My framework is written in Swift, so that might have some different rules than an Obj-C framework.) You might want to look into the Sharing Code between iOS and OS X video from WWDC 2014 for some more information on configuring a framework target.

https://developer.apple.com/videos/play/wwdc2014-233/

Hmm, I am pretty sure that was how I first tried to add the framework, but as I said the only thing that compiles is the way I added it. Anyhow - I double-check that is the case now.

Yeah, so doesn't help for me - at least here on Xcode 6.4. I have to manually add paths to the temp build directory.


I guess I will install the Xcode 7.1.1 to see if it works better, but I was hoping to get this issue figured out before upgrading as Xcode 7. Last two times I tried Xcode 7 beta, it gave me too much grief (hundreds of error messages even though I requested not to upgrade the Swift) to have started using it then.


But now I have no choice as I have a blank new iPad Pro staring at me. 😉

"...even though I requested not to upgrade the Swift..."

If you go to Xcode 7.x, you will have to upgrade your Swift code to Swift 2.x. The only option you have is whether you want Xcode to attempt to make the changes for you. If you say No, you have to make all the changes yourself. If you say Yes, Xcode will get some (most?) of the changes, but you will still probably have to fix some things yourself.