我已经在XMPP框架的帮助下实现了一个聊天应用程序.但是我收到的错误显示如下:
xmpp did receive error:-
Printing description of error:
<stream:error xmlns:stream="http://etherx.jabber.org/streams"><conflict xmlns="urn:ietf:params:xml:ns:xmpp-streams"></conflict><text xmlns="urn:ietf:params:xml:ns:xmpp-streams" lang="">Replaced by new connection</text></stream>
Run Code Online (Sandbox Code Playgroud)
需要一些指导可能导致此错误的原因以及如何重新连接使用XMPP.
谢谢.
使用XMPPReconnect类..
@property (nonatomic, readonly) XMPPReconnect *xmppReconnect;
self.xmppReconnect = [[XMPPReconnect alloc] init];
[self.xmppReconnect activate:self.xmppStream];
[self.xmppReconnect addDelegate:self delegateQueue:dispatch_get_main_queue()];
Run Code Online (Sandbox Code Playgroud)
并实现'XMPPReconnect'委托方法
- (void)xmppReconnect:(XMPPReconnect *)sender didDetectAccidentalDisconnect:(SCNetworkReachabilityFlags)connectionFlags
{
NSLog(@"didDetectAccidentalDisconnect:%u",connectionFlags);
}
- (BOOL)xmppReconnect:(XMPPReconnect *)sender shouldAttemptAutoReconnect:(SCNetworkReachabilityFlags)reachabilityFlags
{
NSLog(@"shouldAttemptAutoReconnect:%u",reachabilityFlags);
return YES;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2256 次 |
| 最近记录: |