XMPP注册失败

时间:2015-02-18 08:57:57

标签: ios iphone xmpp openfire xmppframework

我开始使用XMPP创建一个iPhone聊天应用程序(使用GitHub上提供的robbiehanson / XMPPFramework)。我正在使用goDaddy VPS服务器,使用openfire。在那,我可以登录并与现有用户聊天。但我无法通过我的应用注册新用户。但我可以通过Adium应用程序在服务器上注册新用户,所以我认为这不是服务器设置的问题。

在调试过程中,我发现supportsInBandRegistration方法返回0,因此注册方法没有执行。

我使用以下代码进行注册:

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

appDelegate.xmppStream.myJID = [XMPPJID jidWithString:username];

NSLog(@"Support for registration %u ", appDelegate.xmppStream.supportsInBandRegistration );
NSLog(@"Attempting registration for username %@",appDelegate.xmppStream.myJID.bare);

if (appDelegate.xmppStream.supportsInBandRegistration) {
    NSError *error = nil;
    if (![appDelegate.xmppStream registerWithPassword:password error:&error])
    {
        NSLog(@"Oops, I forgot something: %@", error);
    }else{
        NSLog(@"No Error");
    }
}
else {
    NSLog(@"Inband registration check failed");
}

任何人都可以为此提出解决方案。

提前致谢....

0 个答案:

没有答案