Browse Source

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 years ago
parent
commit
b03798fb30
1 changed files with 2 additions and 1 deletions
  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)")
         }
     }