几个小时以来,我一直在尝试向我的当前项目添加SwiftMonkey-Target,但似乎没有任何效果。
https://github.com/zalando/SwiftMonkey中的Example-Project正在运行。一切都按照相同的方式/按照说明进行设置。
这是测试代码(与示例代码相同):
import XCTest
import SwiftMonkey
class AdviceAppMonkeyTests: XCTestCase {
override func setUp() {
super.setUp()
XCUIApplication().launch()
}
override func tearDown() {
super.tearDown()
}
func testMonkey() {
let application = XCUIApplication()
_ = application.descendants(matching: .any).element(boundBy: 0).frame
let monkey = Monkey(frame: application.frame)
monkey.addDefaultXCTestPrivateActions()
monkey.addDefaultUIAutomationActions()
monkey.addXCTestTapAlertAction(interval: 100, application: application)
monkey.monkeyAround(forDuration: 10)
}
}
这是我的podfile:
platform :ios, '11.0'
use_frameworks!
def advice_pods
pod 'SwiftyJSON'
pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'SwiftLint'
end
target 'AdviceApp' do
advice_pods
pod 'SwiftMonkeyPaws', '~> 2.1.0'
end
target 'Daily Advice' do
advice_pods
end
target 'AdviceAppTests' do
advice_pods
end
target 'AdviceAppMonkeyTests' do
advice_pods
pod 'SwiftMonkey', '~> 2.1.0'
end
运行测试时,我会收到“测试失败”警告以及
2019-01-07 10:15:54.790962 + 0100 AdviceAppMonkeyTests-Runner [14731:110840]无法加载捆绑包“ AdviceAppMonkeyTests”,因为它已损坏或缺少必要的资源。尝试重新安装捆绑软件。 2019-01-07 10:15:54.791073 + 0100 AdviceAppMonkeyTests-Runner [14731:110840](dlopen_preflight(/Users/matthias.zarzecki/Library/Developer/Xcode/DerivedData/AdviceApp-hantxpruajwefgbjvzwhvlvwhmrh/Build/Products AdviceAppMonkeyTests-Runner.app/PlugIns/AdviceAppMonkeyTests.xctest/AdviceAppMonkeyTests):库未加载:@ rpath / libswiftSwiftOnoneSupport.dylib 引用自:/Users/matthias.zarzecki/Library/Developer/Xcode/DerivedData/AdviceApp-hantxpruajwefgbjvzwhvlvwhmrh/Build/Products/Debug-iphonesimulator/AdviceAppMonkeyTests-Runner.app/PclugIns/AdviceAppMontestKeys。 原因:找不到图片)
您有什么想法可以尝试吗?
答案 0 :(得分:0)
我与创作者一起工作了几天,以解决这个问题,我们发现了:)
此处所有详细信息:https://github.com/zalando/SwiftMonkey/issues/71
TLDR: use_frameworks只需要进入内部主要目标的目标舱
platform :ios, '11.0'
target 'AdviceApp' do
use_frameworks!
pod 'SwiftyJSON'
pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'SwiftLint'
pod 'SwiftMonkeyPaws'
end
target 'AdviceAppMonkeyTests' do
pod 'SwiftMonkey', '~> 2.1.0'
pod 'SwiftLint'
end
或者将构建系统设置为“旧版”也可以使它正常工作,但是将来有可能在其他地方出错