问题描述
我拥有 OCMock (1.55)和XCode 3.2的最新版本. 3.
I have the last version of OCMock (1.55) and XCode 3.2.3.
我在项目中创建了一个测试包目标. 在我的测试中使用OCMock的最佳方法是什么?当我将OCMock.framework添加到测试包中时,会出现以下构建错误:
I have created a test bundle target in my project. What is the best way to use OCMock in my tests?When I add OCMock.framework to the test bundle, this build error appears:
"_OBJC_CLASS_$_OCMockObject", referenced from:
objc-class-ref-to-OCMockObject in NotificationTests.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
推荐答案
我遇到了同样的问题,这是我如何解决的问题:
I had the same problem, here is how i solved it :
-
删除ocmock.framework,复制文件阶段以及链接到ocmock标头的所有搜索路径.
Delete ocmock.framework, the copy file phase, and any search path linking to ocmock header.
从ocmock svn存储库中检出最新版本: http://svn. mulle-kybernetik.com/OCMock/trunk
check out the latest version from ocmock svn repo : http://svn.mulle-kybernetik.com/OCMock/trunk
构建OCMockPhoneSim目标
Build the OCMockPhoneSim target
将libOCMock.a和Headers文件夹复制到您的项目文件夹中
Copy the libOCMock.a and Headers folder in your project folder
将libOCMock.a添加到您的框架,并在目标库搜索路径中添加指向headers文件夹的链接.
add the libOCMock.a to your framework and add a link to the headers folder in your target library search path.
然后它起作用了!
希望这会有所帮助.
这篇关于适用于iPhone的OCMock(iOS4,XCode 3.2.3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!