I have finally figured out how to use the apple Reachability files, which is a great thing.
My question is, since I have about 6 views, each of which needs to check to see if I am connected to the internet. What is the best way to implement Reachability (including NSNotificationCenter so I know automatically when the connection has changed) across my app so that I am not copying and pasting the same code inside each class.
I assume something inside my app delegate. But how would I implement NSNotificationCenter and let all my other classes know when the connection has changed?
You can use this code in whatever view you want notifications for when the reachability changes:
You’ll want to define the method
- (void)reachabilityChanged:(NSNotification* )note(or whatever you call it) to receive this notification.Hope this helps!