views:

39

answers:

2

Hi, Guys.

I'm having some trouble to embed my application with the log4cocoa framework.I've embed frameworks in my application before with no trouble, but I cannot fix this one.

First of all, this is my system out:

dyld: Library not loaded: @loader_path/Frameworks/Log4Cocoa.framework/Versions/A/Log4Cocoa
  Referenced from: /Users/leandro/Documents/Projects/MLoggerApplication/build/Debug/MLoggerApplication.app/Contents/MacOS/MLoggerApplication
  Reason: image not found

Well, I think done all necessary steps to get a framework working fine including the copy files phase and changed the installation directory over the build options to @executable_path/../Frameworks .

I hope problem clear enough to receive your help. Thanks in advance.

A: 

Looks like your framework isn't being copied into your target. If a framework isn't part of the system (ie, you have to distribute it with your app), you need to not only link your executable against the framework but to copy it into your app's ./Frameworks folder.

To do this, add a Copy Files build phase, select "Frameworks" as the build phase's destination, then drag the framework (from your Frameworks folder in your Xcode project) under that Copy Files build phase you just created. If you already have a Copy Files build phase for Frameworks, then just use it instead of creating a new one.

Joshua Nozzi
Hi, Joshua.First of All, Thank you for answering the question.I already have a Copy Files build phase for Frameworks.I didn`t understand what you mean with "just use it instead of creating a new one." Am I creating a new one?
Leandro
I meant that if a Copy Files build phase exists *for Frameworks* you can just use that one. There's one for Resources but you definitely need one for Frameworks as well. Then you need to drag the framework in question down into that build phase, instructing Xcode to copy it into your target's ./Frameworks folder when it is built.
Joshua Nozzi
A: 

Firstly, i mean, Joshua Nozzi is completely right about how is to embed an app with a framework!

But log4cocoa as a little different and could only realize that because it is an opensource code able for download at http://sourceforge.net/projects/log4cocoa/.

The framework could be used with this configuration by adding a "Copy Files build phase, but instead "Frameworks", select "Products Directory" as the build phase's destination, then drag the framework to that "Copy Files build phase.

The difference among this, and the other frameworks relies in this build variable: installation directory.It has as default value: "/Frameworks . This variable can be accessed by right clicking on the log4cocoa(first item in the targets list), then select "Get Info" and finally "build".

To use it as "normal" framework rebuild it after you have edited the "installation directory" value to "@executable_path/../Frameworks" or if you are going to embed a framework with it, you would prefer "@loader_path/../Frameworks"

Leandro