Rob*_*ins 12 ios cocoapods swift xcode7 xcode-ui-testing
我有一个现有的Objective-C项目,我想添加一个新的Xcode 7 UI测试目标,OHHTTPStubs作为依赖项.
我在Xcode中添加了新的(Swift 2.0)UI测试目标,然后将其添加到我的Podfile:
target 'FooUITests' do
pod 'OHHTTPStubs', '4.0.1'
end
Run Code Online (Sandbox Code Playgroud)
我跑pod update,清理,重建.但是当我尝试import OHHTTPStubs在模板UI测试的顶部测试.swift文件Xcode为我创建时,它抱怨"没有这样的模块'OHHTTPStubs'".
我正在使用Cocoapods版本0.37.2-将Objective-C依赖项导入到Swift(... UI测试)目标中,甚至可以工作吗?
更新:正如我在下面的自我回答中所述,添加use_frameworks!到我的Podfile让我得到了清晰的编译 - 我可以import 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)
Run Code Online (Sandbox Code Playgroud)
虽然我的目录下似乎有Release-iphoneos和Release-iphonesimulator构建.OHHTTPStubs.framework~/Library/Developer/DerivedData
有关正在发生的事情的任何提示?
结果我需要做的就是告诉 Cocoapods use_frameworks!(仅适用于 Swift 目标)Podfile:
target 'FooUITests' do
use_frameworks!
pod 'OHHTTPStubs', '4.0.1'
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2577 次 |
| 最近记录: |