I tried to use NetworkReachabilityManager as follow in the iOS example, but it doesn't work correctly:
status :reachable(Alamofire.NetworkReachabilityManager.ConnectionType.ethernetOrWiFi)
status :notReachable
And I turned the airplane mode on to disconnect the internet, it didn't respond to show me the internet is off.
When I turned the airplane mode, it shows
statuslala :reachable(Alamofire.NetworkReachabilityManager.ConnectionType.ethernetOrWiFi)
statuslala :notReachable
statuslala :reachable(Alamofire.NetworkReachabilityManager.ConnectionType.ethernetOrWiFi)
statuslala :notReachable
The result is not correct. Can you please figure it out what's the problem?
The testing profile is:
Xcode 8.2 beta
iPhone 6, iOS 10.1.1
The newest Alamofire commit: 928cdae0c54957cb53a6873ec64a109bc6a1be60
Under 3G internet
class MasterViewController: UITableViewController {
@IBOutlet weak var titleImageView: UIImageView!
let manager = NetworkReachabilityManager(host: "https://www.apple.com/")
var detailViewController: DetailViewController? = nil
var objects = NSMutableArray()
override func awakeFromNib() {
super.awakeFromNib()
navigationItem.titleView = titleImageView
weak var wSelf = self
manager?.listener = {status in
print("statuslala :\(status)")
let alert = UIAlertController(title: "Alert", message: "status:\(status)", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Click", style: .default, handler: nil))
wSelf?.present(alert, animated: true, completion: nil)
}
manager?.startListening()
}
You need to use www.apple.com as the host. It gets all screwed up when you throw the scheme in there.
Cheers. 馃嵒
Awesome! Problem sovled. I hope this colsed issue helpful to others...
Most helpful comment
You need to use
www.apple.comas the host. It gets all screwed up when you throw the scheme in there.Cheers. 馃嵒