Reachability icon indicating copy to clipboard operation
Reachability copied to clipboard

reachabilityWithHostname not available in Swift?

Open paulgoh opened this issue 8 years ago • 3 comments

Hi! I was using reachabilityWithHostname with great results on Objective-C and after switching to Swift, I couldn't use reachabilityWithHostname anymore as it seems to be missing. Is there any reason for this?

paulgoh avatar Jun 16 '16 17:06 paulgoh

Did you try this?

let reachability = Reachability(hostName: "www.yoursite.com")

kevin-hirsch avatar Jul 18 '16 13:07 kevin-hirsch

Hi. When not exist site search, always return 'true' Is there any reason for this? `

    let notexgist12341234 = Reachability(hostName: "www.notexgist12341234.com")

    let a = Reachability(hostname: "https://api-dev.allawin.co.kra")
    let b = Reachability(hostname: Config.apiAddress)
    let c = Reachability.reachabilityForInternetConnection()

    print ("notexgist12341234 : \(notexgist12341234) \(notexgist12341234.isReachableViaWWAN()) \(yoursite12341234.isReachableViaWiFi()) ")
    print ("a : \(a) \(a.isReachableViaWWAN()) \(a.isReachableViaWiFi()) ")
    print ("b : \(b) \(b.isReachableViaWWAN()) \(b.isReachableViaWiFi()) ")
    print ("c : \(c) \(c.isReachableViaWWAN()) \(c.isReachableViaWiFi()) ")

`

["yoursite12341234 : <Reachability: 0x26f98fc0 (-R -------)> false true "] ["a : <Reachability: 0x280b3cc0 (-R -------)> false true "] ["b : <Reachability: 0x280b42f0 (-R -------)> false true "] ["c : <Reachability: 0x280b2ce0 (-R -------)> false true "]

saintevil avatar Aug 16 '16 06:08 saintevil

I checked issue. When returned call back. It's value correct in iOS 9.x iOS 8.x is always correct value

saintevil avatar Aug 16 '16 09:08 saintevil