如何在 Xcode 的 UI 测试类的目标中包含 SwiftyUserDefaults.swift? [英] How to include SwiftyUserDefaults.swift in the target for UI Test class in Xcode?

查看:25
本文介绍了如何在 Xcode 的 UI 测试类的目标中包含 SwiftyUserDefaults.swift?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 iPhone 的 Xcode swift 应用程序中创建了一个用户界面测试类,它作用于屏幕并按下一些按钮.但是构建失败,因为某些库(SwiftyUserDefaults.swift 和 SwiftyJSON.swift)未包含在 Test 类的目标中 - 我收到错误:

当我像这样在测试类的编译资源中包含类 SwiftyJSON.swift 时:

我收到另一个错误,这基本上意味着我

我该怎么办?如何在 UI 测试类的目标中包含库?

解决方案

确保为实用工具"窗格中的每个 Swift 文件选择了 UI 测试包 -> 目标成员:

I have made a user interface testing class in Xcode swift application for iPhone, that acts on the screen and presses some buttons. However the build fails because some of the libraries (SwiftyUserDefaults.swift, and SwiftyJSON.swift) are not included in the target for Test class - I get the error:

When I included the class SwiftyJSON.swift in the compile resources for the test class like this:

I get another error, that essentially means that I included the same file twice:

What should I do? How to include the library in the target for UI Test class?

解决方案

Ensure you have your UI test bundle selected for each Swift file in the Utilities pane -> Target Membership:

这篇关于如何在 Xcode 的 UI 测试类的目标中包含 SwiftyUserDefaults.swift?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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