How to return BOOL when checking internet connection in XCODE

前端 未结 4 1141
自闭症患者
自闭症患者 2021-01-23 03:52

I want to be able to check for internet connectivity when my View loads. To predetermine the contents of my view.

I have the following viewDidLoad method:



        
4条回答
  •  没有蜡笔的小新
    2021-01-23 04:15

    I think you can use the Apple provided Reachability class. There is a method: - (NetworkStatus)currentReachabilityStatus;

    As it returns NetworkStatus. You can use this value directly or inside your function reachabilityStatus != NotReachable

提交回复
热议问题