Ver código fonte

Update sample apps

Ashley Mills 9 anos atrás
pai
commit
dcd8e44d6c

+ 2 - 8
ReachabilityAppleTVSample/ViewController.swift

@@ -38,14 +38,8 @@ class ViewController: UIViewController {
         
         print("--- set up with host name: \(hostNameLabel.text!)")
         
-        do {
-            let reachability = try useHostName ? Reachability(hostname: hostName) : Reachability.reachabilityForInternetConnection()
-            self.reachability = reachability
-        } catch ReachabilityError.FailedToCreateWithAddress(let address) {
-            networkStatus.textColor = .red
-            networkStatus.text = "Unable to create\nReachability with address:\n\(address)"
-            return
-        } catch {}
+        let reachability = useHostName ? Reachability(hostname: hostName) : Reachability()
+        self.reachability = reachability
         
         if useClosures {
             reachability?.whenReachable = { reachability in

+ 2 - 8
ReachabilityMacSample/ViewController.swift

@@ -38,14 +38,8 @@ class ViewController: NSViewController {
 
     print("--- set up with host name: \(hostNameLabel.stringValue)")
 
-    do {
-      let reachability = try useHostName ? Reachability(hostname: hostName) : Reachability.reachabilityForInternetConnection()
-      self.reachability = reachability
-    } catch ReachabilityError.FailedToCreateWithAddress(let address) {
-      networkStatus.textColor = .red
-      networkStatus.stringValue = "Unable to create\nReachability with address:\n\(address)"
-      return
-    } catch {}
+    let reachability = useHostName ? Reachability(hostname: hostName) : Reachability()
+    self.reachability = reachability
 
     if useClosures {
       reachability?.whenReachable = { reachability in