|
|
@@ -86,19 +86,19 @@ public class Reachability: NSObject {
|
|
|
|
|
|
// MARK: - *** Initialisation methods ***
|
|
|
|
|
|
- required public init(reachabilityRef: SCNetworkReachability) {
|
|
|
+ required public init?(reachabilityRef: SCNetworkReachability?) {
|
|
|
reachableOnWWAN = true
|
|
|
self.reachabilityRef = reachabilityRef
|
|
|
}
|
|
|
|
|
|
- public convenience init(hostname: String) {
|
|
|
+ public convenience init?(hostname: String) {
|
|
|
|
|
|
let nodename = (hostname as NSString).UTF8String
|
|
|
let ref = SCNetworkReachabilityCreateWithName(nil, nodename)
|
|
|
self.init(reachabilityRef: ref)
|
|
|
}
|
|
|
|
|
|
- public class func reachabilityForInternetConnection() -> Reachability {
|
|
|
+ public class func reachabilityForInternetConnection() -> Reachability? {
|
|
|
|
|
|
var zeroAddress = sockaddr_in()
|
|
|
zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
|
|
|
@@ -111,7 +111,7 @@ public class Reachability: NSObject {
|
|
|
return Reachability(reachabilityRef: ref)
|
|
|
}
|
|
|
|
|
|
- public class func reachabilityForLocalWiFi() -> Reachability {
|
|
|
+ public class func reachabilityForLocalWiFi() -> Reachability? {
|
|
|
|
|
|
var localWifiAddress: sockaddr_in = sockaddr_in(sin_len: __uint8_t(0), sin_family: sa_family_t(0), sin_port: in_port_t(0), sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0))
|
|
|
localWifiAddress.sin_len = UInt8(sizeofValue(localWifiAddress))
|