问题描述
所以我遇到了一个问题,我的框架需要访问 KeyChain
。这没关系,但在模拟器中运行时似乎失败了。挖掘它似乎是一个已知的问题, xctest
在这里做错了。很公平,错误发生了。在Apple Developer论坛中,我们在这里讨论:
So I am running into an issue where my Framework needs access to the KeyChain
. That's fine, but it seems to fail when running in the simulator. Digging around it seems to be a known issue that xctest
does the wrong thing here. Fair enough, bugs happen. In the Apple Developer forums it's discussed here:
https://forums.developer.apple.com/message/179846 (see: Eskimo's reply on Nov 4, 2016 2:12 AM)
He again goes on to say in another reply:
So again he references:
You can avoid the problem by running your tests within an app, creating a dummy app if you don’t have one handy.
I'm more than happy to do this, I just can't seem to figure out how.
The parts I have:
Framework Project
|
|- Unit Test Target
|- Framework Target
Dummy App Project
|
|- ??? How do I make this run the Framework's Unit Test Target?
Ah, this article helped:
https://medium.com/@ryuichi/setup-host-app-for-keychain-tests-in-xcode-8-97222611917e#.z3zpqwnzt
I was adding a totally new app project, I just needed to add a new Target in the Framework project for a Single View Application
That then allows me to select Host Application
in the testing target.
Using my previous diagram, the final result that worked is:
Framework Project
|
|- Unit Test Target
|- Framework Target
|- Dummy App Target
这篇关于如何获取iOS Framework测试目标并在虚拟应用程序中运行它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!