IPhone Connectivity Testing: How do I force it to lose connection?

后端 未结 7 1198
旧时难觅i
旧时难觅i 2021-02-07 11:52

Apple wants me to give the user a friendly apology if I can\'t find an internet connection. Using the Reachability Demo, this was easy enough. I want to take it a step further a

7条回答
  •  别那么骄傲
    2021-02-07 12:35

    If you're developing in the iPhone Simulator, simply disconnect your computer from the internet. If your computer has no network access, neither does the iPhone Simulator.

    To test on the device, you can do the following:

    First, setup a WiFi router that you can use for testing.

    You can turn on Airplane mode on the phone, then turn WiFi back on. This will prevent the 3G connection from providing data access.

    Launch your application. Now you can simply disconnect your WiFi router to simulate a loss of connectivity.

提交回复
热议问题