Is it possible to disable the network in iOS Simulator?

后端 未结 20 1334
名媛妹妹
名媛妹妹 2020-11-30 15:58

I am trying to debug some inconsistent behaviour I am seeing in an application that gets its primary data from the internet. I don\'t see the issues in the simulator, just

20条回答
  •  死守一世寂寞
    2020-11-30 16:43

    With Xcode 8.3 and iOS 10.3:

    XCUIDevice.shared().siriService.activate(voiceRecognitionText: "Turn off wifi")
    XCUIDevice.shared().press(XCUIDeviceButton.home)
    

    Be sure to include @available(iOS 10.3, *) at the top of your test suite file.

    You could alternatively "Turn on Airplane Mode" if you prefer.

    Once Siri turns off wifi or turns on Airplane Mode, you will need to dismiss the Siri dialogue that says that Siri requires internet. This is accomplished by pressing the home button, which dismisses the dialogue and returns to your app.

提交回复
热议问题