[英]Migration of OCUnit to XCTest leads to linker error
I've tried to migrate our OCUnit
to XCTest
. 我试图将
OCUnit
迁移到XCTest
。 So I have 100% compilable project but I see next linker error: 所以我有100%可编译的项目,但是我看到下一个链接器错误:
Error:Undefined symbol '_OBJC_CLASS_$_XCTestCase' referenced from:...
My "Framework Search Paths"
looks like this: 我的
"Framework Search Paths"
如下所示:
$(SDKROOT)/Developer/Library/Frameworks (non-recursive)
$(inherited) (non-recursive)
$(DEVELOPER_FRAMEWORKS_DIR) (non-recursive)
I'm not familiar what else to do to satisfy linker 我不知道还能做什么来满足链接器的要求
I am seeing the exact same error messages in Xcode 6.1 after migrating with 迁移至Xcode 6.1后,我看到了完全相同的错误消息
Pull Down Menu → Edit → Refactor → Convert to XCTest . 下拉菜单 → 编辑 → 重构 → 转换为XCTest 。
I got 2 solutions: 我有2个解决方案:
Backup all source files in your test project. 备份测试项目中的所有源文件。
In Project Navigator , select the project. 在项目浏览器中 ,选择项目。
This shows the project settings. 这显示了项目设置。
In the project settings, click Show project and targets list . 在项目设置中,单击显示项目和目标列表 。
Select the test target , and press delete to delete it. 选择测试目标 ,然后按Delete键将其删除。
In Project Navigator , select the test target , and press delete to delete it. 在Project Navigator中 ,选择测试目标 ,然后按Delete键将其删除。
In Test Navigator , click the + button on the bottom left, and choose New Test Target . 在“ 测试导航器”中 ,单击左下角的+按钮,然后选择新建测试目标 。
Add your original source files back into the new test target. 将原始源文件重新添加到新的测试目标中。
Now test your project as usual. 现在像往常一样测试您的项目。
In Project Navigator , select the project. 在项目浏览器中 ,选择项目。
This shows the project settings. 这显示了项目设置。
In the project settings, select the test target (not the main target), then select Build Phases . 在项目设置中,选择测试目标 (不是主要目标),然后选择Build Phases 。
In Link Binary With Libraries , click the + button. 在“将二进制文件与库链接”中 ,单击+按钮。
This shows the list of frameworks, but there is no XCTest. 这显示了框架列表,但是没有XCTest。
Choose a framework that you don't use at all, say, Twitter.framework , and click Add . 选择一个根本不用的框架,例如Twitter.framework ,然后单击“ 添加” 。
Open your project file ( something.pbxproj ) in a text editor, and replace all occurrences of Twitter.framework with XCTest.framework . 在文本编辑器中打开您的项目文件( something.pbxproj ),并将所有出现的Twitter.framework替换为XCTest.framework 。
Note: the pbxproj file is inside the .xcodeproj folder. 注意: pbxproj文件位于.xcodeproj文件夹内。 In Finder, you have to right click on the .xcodeproj and select Show Package Contents .
在Finder中,您必须右键单击 .xcodeproj,然后选择显示包内容 。
Go back to Link Binary With Libraries in Xcode, and check that XCTest.framework is added. 返回到Xcode中的使用库链接二进制文件 ,并检查是否已添加XCTest.framework 。
Now test your project as usual. 现在像往常一样测试您的项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.