使用xmpp / jabber的iPhone聊天应用。 这种方法我无法在服务器上注册。它给了我“403”错误。 任何人都可以帮助我,我如何使用ios中的xmpp / jabber在服务器上创建一个新帐户?
这里是我的代码:
NSString *username = loginField.text;
NSString *password = passwordField.text;
AppDelegate *del = (AppDelegate *)[[UIApplication sharedApplication] delegate];
del.xmppStream.myJID = [XMPPJID jidWithString:username];
NSLog(@"Does supports registration %hhd ",del.xmppStream.supportsInBandRegistration );
NSLog(@"Attempting registration for username %@",del.xmppStream.myJID.bare);
if (del.xmppStream.supportsInBandRegistration)
{
NSError *error = nil;
if (![del.xmppStream registerWithPassword:password error:&error])
{
NSLog(@"Oops, I forgot something: %@", error);
}
else
{
NSLog(@"No Error");
}
}
我得错了
错误: -
<iq xmlns="jabber:client" from="username@Testlocalhost" to="username@Testlocalhost/40751035661420464079722458" type="error">
<query xmlns="jabber:iq:register">
<username>newusername</username>
<password>userpassword</password>
</query>
<error code="403" type="auth">
<forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>