小编Joe*_*Joe的帖子

无法在 Swift 的 xcode UI 测试中使用 Alamofire

我遇到的问题是使用Alamofirexcode UI 测试。

\n\n

我已尽可能地将各个部分隔离开来,试图找出问题可能出在哪里,但仍然无法解决这个问题。通过使用 swift 的新 xcode 项目,我可以Alamofire按预期使用 mainViewController.swiftfunc viewDidLoad()函数,但是在创建 UI 测试时,我无法在函数中使用相同的代码func testExample()

\n\n

使用的工具版本:

\n\n
Xcode     = 9.2(9C40b)    \nSwift     = 4.0\ncocoapods = 1.4.0     \nmacOS     = High Sierra Version 10.13.2 (17C205)  \nAlamofire = 4.5    \n
Run Code Online (Sandbox Code Playgroud)\n\n

ViewController.swift - 工作正常

\n\n
import UIKit\nimport Alamofire\n\nclass ViewController: UIViewController {\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        // Do any additional setup after loading the view, typically from a nib.\n\n        Alamofire.request("https://httpbin.org/get").responseJSON { response in\n            print("Request: …
Run Code Online (Sandbox Code Playgroud)

xcode cocoapods swift alamofire xcode-ui-testing

5
推荐指数
1
解决办法
1223
查看次数

标签 统计

alamofire ×1

cocoapods ×1

swift ×1

xcode ×1

xcode-ui-testing ×1