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
Post a Comment