views:

127

answers:

2

Hi,

I've created a working Cocoa framework which I wish to redistribute. The problem is however, it won't run outside of Xcode. I've read something about @executable_path/../Frameworks, which I did not include, because I don't know where to put it :/

Therefore I run my app in Xcode using the DYLD_FRAMEWORK_PATH variable which works fine, but only in Xcode - if I try to run it on its own it crashes straight away and says IMAGE NOT FOUND.

I'm sure @executable_path/../Frameworks is what's missing, but I don't know where to put it.

Could anyone help me out please? :)

Thanks

+2  A: 

Here is how I usually manage things:

  1. In the framework's Xcode project, set the Installation Directory to @rpath

  2. Add the framework to your application's Xcode project. Add a Copy Files build phase, select Frameworks in the Destination popup, and ensure your framework is added so it will be copied to your application's Frameworks directory when it is built.

  3. Finally, in your project's settings, add @loader_path/../Frameworks to Runpath Search Paths.

sbooth
I think it's not happy with the @executable_path - I've uploaded a screenshot of the run log here: http://web.me.com/david.schiefer/error.tiff
David Schiefer
If you use @rpath there is no need for @executable_path, so I'm not sure why you're seeing this error.
sbooth
A: 

Are you actually copying the framework into your applications bundle? Look for the folder called MacOS which is what contains the binary. There should be another folder at the same level called Frameworks and it should have the framework inside it.

If it's not there you need to create a copy files build phase for the application that copies the framework into the Frameworks folder.

JeremyP
when clicking on "Show Contents", I see a Frameworks (it has my framework in it), Resources and MacOS.
David Schiefer
and yes it has my framework in it, but it still doesnt work
David Schiefer
OK, next thing is to find out where the application thinks it should be. Open a terminal session, go into the MacOS directory and run `otool -L` on the binary.
JeremyP
done - http://web.me.com/david.schiefer/otool.tiff
David Schiefer
First thought is that there is a misconfiguration in your linking process. @executablepath/../Frameworks is not a library or a framework. The reference should be to your actual framework not the folder containing it.
JeremyP
All the other frameworks in your posted tiff give you an example of what the end of the path should look like.
JeremyP
I've attempted changing the path, but now it won't apply it any more - even after cleaning the project, it still uses /../Frameworks as its path :S this is driving me nuts... :P
David Schiefer
Please post the exact transcript of the link command of your application into your question. There's something weird going on there. To get the transcript, open the build window, set it to show "All Messages" then find the link line for the application. Drag that line into a text editor and then paste it from there into the question.
JeremyP
it's too big to be pasted, so i uploaded it to my server instead: http://web.me.com/david.schiefer/log.txt
David Schiefer
I think possibly the install_name option is incorrect. It should point to the actual framework. Going forward, what I would do now is create a fresh project to build your application and your framework and follow Apple's directions for configuring private frameworks to the letter. http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#//apple_ref/doc/uid/20002258-106880-BAJJBIEF
JeremyP
David Schiefer
If it were a public framework, you'd want to install it in /Library/Frameworks or ~/Library/Frameworks not in your application bundle.
JeremyP
how does sparkle do it then? all i need to do for that is copy it into the bundle, that's far more convenient... :/
David Schiefer