Search code examples
iosobjective-creachability

Is there any method to call back when internet is connected?


i checked answers in here about internet connections and reachability classes but i could not find answer to my question yet. I need to know if any delegate method exist to call back when app is connected to internet. I don't want to check if internet exist with NSTimer or NSThread any moment. I would be happy to know any idea.


Solution

  • there is a notification kReachabilityChangedNotification in Reachability class, which is post when reachability of internet changed. Also, there are reachableBlock and unreachableBlock, look at

    -(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags

    in Reachability.m file