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

后端 未结 7 1196
旧时难觅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:22

    You could install Apple's Network Link Conditioner

    On Yosemite:

    Network Link Conditioner can be found in the "Hardware IO Tools for Xcode" package. This can be downloaded from the Apple Developer Downloads page. Once the download has finished, open the DMG and double-click "Network Link Condition.prefPane" to install (source).

    With this preferences panel you could create a profile with 0kbps speed.

    Network Link Conditioner

    On older versions of OSX:

    Mountain Lion / Mavericks: Xcode > Open Developer Tool > More Developer Tools
    Lion: /Developer/Applications/Utilities/Network Link Conditioner

    0 讨论(0)
  • 2021-02-07 12:27

    You can use the SpeedLimit preference pane to simulate network latency under the simulator. And here's a command line version built on top of the ipfw command.

    The advantage over just yanking the cord or killing WiFi is that you can specify the speed when hitting specific hosts so it can be used for testing without killing your regular network services.

    0 讨论(0)
  • 2021-02-07 12:27

    Perhaps this preference pane is also useful for you: SpeedLimit.prefPane it can't loose the connection, but you can slow down it based on the host and port you're trying to reach.

    0 讨论(0)
  • 2021-02-07 12:27

    Searching for similar need i.e. simulating a lossy wifi network connection on real device, I figured out how to do it :) I connected my MacBook Pro on ethernet and shared my Wifi connection to the device. Using Apple's Network Link Conditioner Prefpane then let me played with the connection quality. Very useful to simulate 3G, Edge and other baudrate.

    Next step : find and buy a usb wifi adapter working on MAC OS X to let all of us (developpers team) to test without wiring each computer to ethernet.

    Hope this will help some of you.

    0 讨论(0)
  • 2021-02-07 12:28

    For testing in the simulator I make great use of Little Snitch. It's a very useful application for writing rules as to what can communicate with the outside world and for how long.

    It will also notify you if an application wishes to access the internet on the fly and you can temporarily restrict access for either that time, that session or forever.

    As for testing on the device, I log into my wireless router and temporarily disable either the network or turn on restriction by MAC ID for the duration of the test.

    0 讨论(0)
  • 2021-02-07 12:32

    Use Charles Web Proxy You can inspect all HTTP/S requests your app sends and responses it receives, throttle connection to simulate any network speed. Create custom throttle profile called "Disconnected" with Bandwidth = 0, to simulate network disconnections.

    0 讨论(0)
提交回复
热议问题