我通过可可豆荚提取 OHHTTPStubs,但我遇到了一些问题,我不知道为什么。这是我的 podFile 的副本
# platform :ios, '11.3'
target 'myApp' do
use_frameworks!
target 'myAppTests' do
inherit! :search_paths
pod 'OHHTTPStubs/Swift'
end
end
在我的测试文件中:
import OHHTTPStubs
@testable import myApp
class myTest: XCTestCase {
var client: CryptoCompareClient!
override func setUp() {
super.setUp()
OHHTTPStubs.onStubMissing { request in
XCTFail("Missing stub for \(request)")
}
}
在这行:
OHHTTPStubs.onStubMissing { request in
XCTFail("Missing stub for \(request)")
}
我收到以下错误:
Type 'OHHTTPStubs' has no member 'onStubMissing'
此外,我正在尝试使用 OHHTTPStubs 从包中加载文件:
let bundle = OHResourceBundle("myFixtures", FixtureLoader.self)!
let path = OHPathForFileInBundle(filename, bundle)!
return OHHTTPStubsResponse(fileAtPath: path, statusCode: 200, headers: nil)
但我收到了这个错误:
使用未解析的标识符“OHResourceBundle”和使用未解析的标识符“OHPathForFileInBundle”
我对你们的问题是我做错了什么或者为什么我会收到这个错误?
我会非常感谢你的帮助。