Swift UI测试无法在iOS 12.3之前的设备上启动 [英] Swift UI tests failing to launch on pre iOS 12.3 devices

查看:345
本文介绍了Swift UI测试无法在iOS 12.3之前的设备上启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一些UI测试,但无法使其在运行iOS 12.3之前的设备上运行.

I'm trying to setup some UI tests but can't get them to run on devices running pre iOS 12.3.

即使我打了一个新的swift项目并勾选了"include UI tests",并尝试在iOS 12.3之前的设备上立即运行UI测试,我也会得到以下信息:

Even if I start a fresh swift project with 'include UI tests' ticked and try to run the UI tests straight away on a pre iOS 12.3 device I get the following:

2019-05-22 15:42:41.543630 + 0100 testUITests-Runner [461:45630]正在运行测试... 2019-05-22 15:42:41.601954 + 0100 testUITests-Runner [461:45630]无法加载捆绑包"testUITests" ,因为它已损坏或丢失了必要的资源.尝试重新安装捆绑软件. 2019-05-22 15:42:41.602043 + 0100 testUITests-Runner [461:45630](dlopen_preflight(/var/containers/Bundle/Application/50D1F2AB-69B9-4C3D-B36B-F84F838E3301/testUITests-Runner.app/PlugIns/testUITests.xctest/testUITests):库未加载:@ rpath/libswiftCore.dylib 引用自:/var/containers/Bundle/Application/50D1F2AB-69B9-4C3D-B36B-F84F838E3301/testUITests-Runner.app/PlugIns/testUITests.xctest/testUITests 原因:未找到图片)

2019-05-22 15:42:41.543630+0100 testUITests-Runner[461:45630] Running tests... 2019-05-22 15:42:41.601954+0100 testUITests-Runner[461:45630] The bundle "testUITests" couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 2019-05-22 15:42:41.602043+0100 testUITests-Runner[461:45630] (dlopen_preflight(/var/containers/Bundle/Application/50D1F2AB-69B9-4C3D-B36B-F84F838E3301/testUITests-Runner.app/PlugIns/testUITests.xctest/testUITests): Library not loaded: @rpath/libswiftCore.dylib Referenced from: /var/containers/Bundle/Application/50D1F2AB-69B9-4C3D-B36B-F84F838E3301/testUITests-Runner.app/PlugIns/testUITests.xctest/testUITests Reason: image not found)

对于Xcode 6 beta版中的相同错误,我已经看到了各种各样的问题和答案,但是那里的建议都没有帮助,包括:

I've seen various questions and answers for the same errors going back to betas of Xcode 6 but none of the suggestions there have helped, including:

  • 干净的构建
  • 更改证书信任规则
  • 导入CoreLocation
  • 包括一个虚拟swift文件
  • 更改运行路径搜索路径(似乎已在Xcode中修复)
  • 更改始终嵌入快速标准库"的构建设置

我从Xcode 10.2开始,发现了问题,升级到Xcode 10.3并没有帮助.

I started on Xcode 10.2 and found the issue, upgrading to Xcode 10.3 hasn't helped.

在12.2模拟器上运行正常,但在设备上失败.

It was working fine on the 12.2 simulator but fails on a device.

推荐答案

答案非常简单.只需确保在构建设置中,UI测试目标与应用程序具有相同的部署目标即可.

The answer to this is infuriatingly simple. Just make sure, in your build settings, that the UI tests target has the same deployment target as the app.

我已将应用程序更改为iOS 10的目标,但没有想到我需要针对UI测试目标进行相同的更改.

I'd changed the app to target down to iOS 10 but hadn't thought I'd need to make the same change for the UI tests target.

我认为对于我们来说这应该是自动同步的,大概没有理由让它们真正针对不同的版本

I'd imagine this is something that should be auto-synced for us, presumably no reason to have them targeting different versions really

这篇关于Swift UI测试无法在iOS 12.3之前的设备上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆