【发布时间】:2015-05-03 07:11:15
【问题描述】:
我正在尝试连接到这里托管的 ejabberd 服务器:
198.199.106.154:5280
问题是这段代码没有调用 iOS XMPP 框架的委托: - (void)xmppStreamDidConnect:(XMPPStream *)sender
我确信我的服务器已建立连接,因为在代码执行后服务器上会出现以下日志:
- (void)setupStream {
xmppStream = [[XMPPStream alloc] init];
xmppStream.hostName = @"198.199.106.154";
xmppStream.hostPort = 5280;
NSString * jabberID = [[NSString alloc] initWithFormat:@"admin@%@", @"localhost"];
[xmppStream setMyJID:[XMPPJID jidWithString:jabberID]];
NSError *error2 = nil;
[xmppStream connectWithTimeout:10.0f error:&error2];
NSLog(@"here is the connect error %@", [error2 localizedDescription]); //NO ERROR IS CALLED!
dispatch_async(dispatch_get_main_queue(), ^{
[self authWithServer];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(authWithServer) userInfo:nil repeats:YES];
//I GET THE FOLLOWING MESSAGE:: "Please wait until the stream is connected"
});
[xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
}
我完全迷路了!任何指导都会非常有帮助
【问题讨论】:
-
你解决了这个问题@user330739
标签: ios xmpp ejabberd xmppframework