tags:

views:

397

answers:

2

Hi,

I face some difficulties when adding a framework to my project when i run an iPhone app from the command line. My final goal is to run applications tests from an automated build process.

When i run my app from xCode :

I add a "Copy File" build phase to my target and everything goes fine. The copy is set to $(BUILT_PRODUCTS_DIR) as "Absolute path"

When i run my app from the terminal (using iphonesim project) i get this error :

 dyld: Library not loaded: @rpath/OCMock.framework/Versions/A/OCMock

 UIKitApplication:indemnisation[0xb894][26380]     Referenced from: /Users/Admin/Library/Application Support/iPhone Simulator/User/Applications/CD5729B5-A674-49B2-91F6-AD398094B6F8/indemINT.app/indemINT

What i dont understand is that the copy build phase just copies the framework files in the same directory as the app.

When i run the app from the command line the framework files are already in the same directory. Does anyone knows why it doesn't work ?

I've also tried to add the OCMock.framework in the following directories (without success) :

 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library

 /Library/Frameworks

 /Users/Admin/Library/Application Support/iPhone Simulator/User/Applications/CD5729B5-A674-49B2-91F6-AD398094B6F8

Thanks in advance, Vincent.

+2  A: 

The iPhone does not support traditional Mac OS X frameworks. While the iPhone does use folders that end in ".framework", these folders are structured differently than typical Mac OS X frameworks. Most notably, iPhone frameworks are only permitted to use static libraries, while typical Mac OS X frameworks are dynamically loaded. That the message comes from dyld indicates that you are using a shared libary; however, applications targetting the iPhone may only be statically linked.

Michael Aaron Safyan
And note that if you want to do it for OSX, your destination should be set to «Framework», with no subpath, in your «Copy file» build phase, so the framework is included in your app (having it in the same folder as the app is not a solution).
Macmade
A: 

Hi ! I've got the same problem. I tried to link the librairies statically, as the answer said. Then I couldn't link anymore, I had the message : "ld: library not found for -lstdc++-static"

Does someone have a solution for me ?

NBO