ios - How to use reachabilityWithHostName in Swift? -



ios - How to use reachabilityWithHostName in Swift? -

i'm trying utilize reachabilitywithhostname test server connection purpose of recognise whether "the server downwards or not reachable".

however, there error:

'reachabilitywithhostname' unavailable: utilize object construction 'reachability(hostname:)'

swift:

allow _host = "www.google.com" nsstring var netreach: reachability = reachability.reachabilitywithhostname(_host) var netstatus: networkstatus = netreach.currentreachabilitystatus() if (netstatus.value==reachableviawifi.value) { } else if(netstatus.value==reachableviawwan.value) { } else { println("notreachable") }

how can utilize function reachabilitywithhostname?

thanks help.

use

let _host = "www.google.com" nsstring var netreach: reachability = reachability(hostname:_host)

ios swift reachability

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -