Re: Adding frameworks to a Cocoa unit test
Re: Adding frameworks to a Cocoa unit test
- Subject: Re: Adding frameworks to a Cocoa unit test
- From: Chris Hanson <email@hidden>
- Date: Wed, 2 May 2007 12:54:34 -0700
On May 2, 2007, at 12:17 PM, Paul Thomas wrote: I'm trying to add OCMock to my unit tests without installing it. I've done all the usual things - - the OCMock.framework is in the link phase - a "copy files" phase adds it to the bundle Contents/Frameworks - the OCMock.framework has @executable_path/../Frameworks as the install path
However, I'm still getting this: error code 4 (link edit error code 4, error number 0 (Library not loaded: @executable_path/../Frameworks/OCMock.framework/Versions/A/OCMock
Is this because the bundle is inserted in another executable? should I use a different directive?
I've checked, and the framework _is_ there inside the .octest bundle. It's just not finding it.
These are the usual things to do when you want to embed a framework in an application. Since you're using this for unit testing, you don't need to install the framework. Just build or copy the framework into your Built Products Directory (whatever $(BUILT_PRODUCTS_DIR) points to) and it should be picked up by dyld.
The thing that's going wrong is that the framework you're using has an install path of @executable_path, but you're installing it in your Foo.otest bundle. @executable_path will always be the path of the executing executable — either otest for non-injected tests or your application for injected tests — and is therefore likely to never be correct for this use.
The unit testing infrastructure ensures that DYLD_FRAMEWORK_PATH and DYLD_LIBRARY_PATH both contain $(BUILT_PRODUCTS_DIR) when your tests are run, so as long as any additional frameworks such as OCMock are in that directory at that time, they will be picked up regardless of what their install path is set to.
-- Chris
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden