3

I'm developing a hybrid cordova app that should work offline as well. It just caches the data fetched from the network and re-uses the cached version if offline.

Since it's a cordova app, the dev files are on my machine and the url embedded in the app is pointed to my machine, so turning on airplane mode will stop the app to even pull the source code files to start with.

I'm trying to find out what's the approach to develop and test the offline behavior as you code.

Developer
  • 924
  • 3
  • 14
  • 30

2 Answers2

3

Install Additional Tools for XCode 8.2 . This is a network link conditioner. You can simulate many number of network conditions for your device with this.

More about Network Link Conditioner

List of all additional tools is here which includes Additional tool for all versions of xcode.

ahmed
  • 540
  • 2
  • 18
  • but that's for simulator based development, the iPad device in this case is accessing internet directly. Thanks for the enlightenment though. – Developer Nov 10 '17 at 04:41
  • See how to use it on iPad/iPhone device http://www.thomashanning.com/network-link-conditioner/. Scroll to bottom – ahmed Nov 13 '17 at 19:59
  • I could see the Developer setting on iPhone but can't on iPad, I updated iPad as well. (version 11.1.1) – Developer Nov 15 '17 at 21:05
  • 1
    You have to install the app using cable and then the developer mode gets enabled on device – ahmed Nov 15 '17 at 21:20
  • There's a catch, if I turn on network link conditioner to 100% loss, I can't even load files from network. (source code resides on my dev machine and I'm executing code on the device as I develop), seem the only way is to pull the internet plug – Developer Nov 15 '17 at 22:28
  • 1
    Put a breakpoint at a point where all the files are loaded. And simulate 100% loss post that point. Not sure if you require continuous access to remote File system or one time access. – ahmed Nov 16 '17 at 00:41
2

Turn off your wifi connection and proceed(or LAN connection) while testing.

jegadeesh
  • 875
  • 9
  • 22