Register this in your data manager class (if you have any) So everytime there is a change datamanager is notified and it can then hand it over to a place you can easily handle it (perhaps a an alert view popup or etc). If you dont have any datamanager class. put this in appdelegate & keep a boolean variable isReachable, so you can check this everytime you make a request.
What happens to NSNotificationCenter defaultCenter when view controller is changed?
-
26-06-2022 - |
Question
I have a tabBar application with several view controllers. The app requires internet connection all the time, in all the view controllers.
Im using the Apples Reachability class in the first view controller. And it works fine.
viewDidLoad:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus:) name:kReachabilityChangedNotification object:nil];
My question is: Do I have to import this class and the above notification to all the other views as well? Whats the best approach to detect internet connection everywhere in the app?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow