Simulate airplane mode in iPhone Simulator

前端 未结 4 1230
小蘑菇
小蘑菇 2021-01-31 06:29

Is there any way to simulate airplane mode in the iPhone Simulator?

相关标签:
4条回答
  • 2021-01-31 07:18

    Easier hack : make a function checking the connection

    import NetInfo from '@react-native-community/netinfo';
    
    export const ckeckIsConnected = async () => {
      const isConnected = NetInfo.fetch().then((state) => {
        return state.isConnected;
      });
      return isConnected;
    };
    

    Do your data fetching only if there is connection. To simulate no connection, just return false to this function whatever the real connection is.

    0 讨论(0)
  • 2021-01-31 07:21

    Turn off your network connection on the Mac.

    0 讨论(0)
  • 2021-01-31 07:27

    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-01-31 07:30

    You can use Little Snitch too to temp. block the internet connection for this app.

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