iOS/iPhone Reachability - How to only check when internet is lost/not reachable using Reachability.m/.h

前端 未结 7 475
一生所求
一生所求 2021-02-01 09:59

Currently i am using the class by apple reachability.m/.h and it works, except it notifies me for any change, where as i would like to only notify the user if the network is not

7条回答
  •  遇见更好的自我
    2021-02-01 10:25

    I just started playing around with Reachability and hopefully what I discovered is of use to you.

    With regards to multiple 'Not Reachable' while reconnecting, could it be linked to this? Here the poster brought up the definition of 'reachable' for a remote host. I'm guessing while reconnecting the package is not able to go through successfully?

    Another possibility is in Reachability Readme.txt

    IMPORTANT: Reachability must use DNS to resolve the host name before it can determine the Reachability of that host, and this may take time on certain network connections. Because of this, the API will return NotReachable until name resolution has completed. This delay may be visible in the interface on some networks.

    Maybe give it the IP directly and see if it helps?

提交回复
热议问题