我正在xmppReconnect
上激活xmppStream
但如果我没有网络连接,则不会调用reconnect
的委托方法,因此即使网络再次可用,也不会尝试连接。
_xmppReconnect = [[XMPPReconnect alloc] init];
[_xmppReconnect activate:_xmppStream];
[_xmppReconnect addDelegate:self delegateQueue:dispatch_get_main_queue()];
- (BOOL)xmppReconnect:(XMPPReconnect *)sender shouldAttemptAutoReconnect:(SCNetworkReachabilityFlags)reachabilityFlags
{
NSLog(@"shouldAttemptAutoReconnect:%u",reachabilityFlags);
return YES;
}
- (void)xmppReconnect:(XMPPReconnect *)sender didDetectAccidentalDisconnect:(SCNetworkReachabilityFlags)connectionFlags
{
NSLog(@"didDetectAccidentalDisconnect:%u",connectionFlags);
}