Ashley Mills 10 лет назад
Родитель
Сommit
ad6a0d1bae
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      ReachabilitySample/ViewController.swift

+ 5 - 0
ReachabilitySample/ViewController.swift

@@ -35,6 +35,9 @@ class ViewController: UIViewController {
     func setupReachability(useHostName useHostName: Bool, useClosures: Bool) {
     func setupReachability(useHostName useHostName: Bool, useClosures: Bool) {
         let hostName = "google.com"
         let hostName = "google.com"
         hostNameLabel.text = useHostName ? hostName : "No host name"
         hostNameLabel.text = useHostName ? hostName : "No host name"
+        
+        print("--- set up with host name: \(hostNameLabel.text!)")
+
         do {
         do {
             let reachability = try useHostName ? Reachability(hostname: hostName) : Reachability.reachabilityForInternetConnection()
             let reachability = try useHostName ? Reachability(hostname: hostName) : Reachability.reachabilityForInternetConnection()
             self.reachability = reachability
             self.reachability = reachability
@@ -57,6 +60,7 @@ class ViewController: UIViewController {
     }
     }
     
     
     func startNotifier() {
     func startNotifier() {
+        print("--- start notifier")
         do {
         do {
             try reachability?.startNotifier()
             try reachability?.startNotifier()
         } catch {
         } catch {
@@ -67,6 +71,7 @@ class ViewController: UIViewController {
     }
     }
     
     
     func stopNotifier() {
     func stopNotifier() {
+        print("--- stop notifier")
         reachability?.stopNotifier()
         reachability?.stopNotifier()
         NSNotificationCenter.defaultCenter().removeObserver(self, name: ReachabilityChangedNotification, object: nil)
         NSNotificationCenter.defaultCenter().removeObserver(self, name: ReachabilityChangedNotification, object: nil)
         reachability = nil
         reachability = nil