我有一个现有的Objective-C项目,我想添加一个新的
Xcode 7 UI测试目标与
OHHTTPStubs作为依赖.
我在Xcode中添加了新的(Swift 2.0)UI测试目标,然后将其添加到我的Podfile中:
target 'FooUITests' do pod 'OHHTTPStubs','4.0.1' end
我运行荚更新,清理和重建.但是当我尝试导入OHHTTPStubs在模板UI测试.swift文件Xcode为我创建的顶部,它抱怨“没有这样的模块’OHHTTPStubs’”.
我正在使用Cocoapods版本0.37.2 – 正在将一个Objective-C依赖关系导入Swift(… UI测试)目标甚至意味着工作?
更新:如我在下面的self-answer中所述,添加use_frameworks!到我的Podfile让我干净的编译 – 我可以导入OHHTTPStubs在我的测试文件的顶部,引用类和方法,代码完成工作 – 但是当我真的去运行测试我得到以下输出在Xcode控制台:
2015-06-18 10:06:57.134 XCTRunner[51557:609693] The bundle “FooUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 2015-06-18 10:06:57.135 XCTRunner[51557:609693] (dlopen_preflight(/Users/foo/Library/Developer/CoreSimulator/Devices/38181A1B-67B1-4D7F-B434-85361533F985/data/Containers/Bundle/Application/83C68748-55A3-4A02-8862-C18ADEF895B5/FooUITests-Runner.app/PlugIns/FooUITests.xctest/FooUITests): Library not loaded: @rpath/OHHTTPStubs.framework/OHHTTPStubs Referenced from: /Users/foo/Library/Developer/CoreSimulator/Devices/38181A1B-67B1-4D7F-B434-85361533F985/data/Containers/Bundle/Application/83C68748-55A3-4A02-8862-C18ADEF895B5/FooUITests-Runner.app/PlugIns/FooUITests.xctest/FooUITests Reason: image not found)
尽管我的〜/ Library / Developer / DerivedData目录下似乎已经有了Release-iphoneos和Release-iphonesimulator的OHHTTPStubs.framework.
关于发生什么的任何提示?
解决方法
原来所有我需要做的是告诉Cocoapods使用_frameworks! (仅适用于Swift目标)在Podfile中:
target 'FooUITests' do use_frameworks! pod 'OHHTTPStubs','4.0.1' end
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。