Преглед изворни кода

Fix crash in Reachability example. (#3000)

The reachability is not assigned which can cause app crash when
tap on the Reachability Status row
Ethan пре 6 година
родитељ
комит
b03798fb30
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      Example/Source/MasterViewController.swift

+ 2 - 1
Example/Source/MasterViewController.swift

@@ -43,6 +43,7 @@ class MasterViewController: UITableViewController {
         navigationItem.titleView = titleImageView
         clearsSelectionOnViewWillAppear = true
 
+        reachability = NetworkReachabilityManager.default
         monitorReachability()
     }
 
@@ -94,7 +95,7 @@ class MasterViewController: UITableViewController {
     // MARK: - Private - Reachability
 
     private func monitorReachability() {
-        NetworkReachabilityManager.default?.startListening { status in
+        reachability.startListening { status in
             print("Reachability Status Changed: \(status)")
         }
     }