Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #import "Reachability.h"
  2.  
  3. - (id) init {
  4. ...
  5. self.internetReachable = [Reachability reachabilityForInternetConnection];
  6. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus) name:kReachabilityChangedNotification object:nil];
  7. [self.internetReachable startNotifier];
  8. ...
  9. }
  10. - (void) dealloc
  11. {
  12. [self.internetReachable stopNotifier];
  13. [[NSNotificationCenter defaultCenter] removeObserver:self];
  14. }
  15.  
  16. NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
  17.  
  18. - (void)dealloc
  19. { // self.hostReachability is my property holding my Reachability instance
  20. if (self.hostReachability) {
  21. [self.hostReachability stopNotifier];
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement