Explorar o código

Fix crash in Reachability example. (#3000)

The reachability is not assigned which can cause app crash when
tap on the Reachability Status row
Ethan %!s(int64=6) %!d(string=hai) anos
pai
achega
b03798fb30
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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)")
         }
     }