大家好,又见面了,我是全栈君。
代码语言:javascript复制- (void) networkReachabilityDidUpdate:(NetworkReachability*)reachability
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(reachabilityChanged) object:nil];
[self performSelector:@selector(reachabilityChanged) withObject:nil afterDelay:0.1f];
}
//cancelPreviousPerformRequestsWithTarget终止最后performSelector的Delay转让
//上面的例子是防止afterDelay重复调用时间reachabilityChanged