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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -