Swift UI tests failing to launch on pre iOS 12.3 devices

前端 未结 3 1647
太阳男子
太阳男子 2021-01-27 02:58

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

Even if I start a fresh swift project with \'include UI tests\' ticked and

3条回答
  •  旧巷少年郎
    2021-01-27 03:25

    I've found a workaround for this issue, though it's not necessarily reliable for future versions of Xcode so be wary if you decide to try this out (maybe you'd need to repeat the process after an Xcode upgrade).

    If you go to the following directory you'll find all the swift libraries for iPhone devices:

     Applications⁩ ▸ ⁨Xcode⁩ ▸ ⁨Contents⁩ ▸ ⁨Developer⁩ ▸ ⁨Toolchains⁩ ▸ XcodeDefault.xctoolchain⁩ ▸ ⁨usr⁩ ▸ ⁨lib⁩ ▸ ⁨swift⁩ ▸ ⁨iphoneos
    

    You can copy those into your UI tests target (not the app being tested) and then add a copy files build phase to bundle the libraries into the test runner, such that they can be found at runtime. You don't need all the swift libraries, the following image shows which ones I found to be required:

    ⁩It's also worth noting that this messes up running the tests on simulator (no doubt in part because these swift libraries that have been copied are the versions for a device), though there may be a way to get around that or maybe that's fine if you don't intend to run them on the simulator

提交回复
热议问题