Search code examples
iosswiftwatchkitnsurlsessionapple-watch

Network reachability check in WatchKit


As SystemConfiguration framework is not supported for watchKit OS, has anyone worked on or know of an alternate method to do network reachability check in a Watch App?

Please excuse if this is a stupid question as I'm new to this. Thanks in advance.


Solution

  • If you want to check internet connection availability there are two ways.

    1) Just call a simple NSURLSession(Alamofire if you prefer) and it will return you an error with no internet. Using this you can handle your stuff. At a moment there are no such observers to help you with when connection is back.

    2) Using WatchConnectivity framework you can send message to iOS and get the status of internet.

    Best way I would suggest is the first one but still depends on your usage.