OS X ejabberd,新用户通过XMPPFramework

问题描述:

寄存器我是新的ejabberd。我想通过我的iOS应用程序在服务器上添加新用户。 I tried with many code这是从谷歌找到,但没有人能解决我的问题。OS X ejabberd,新用户通过XMPPFramework

我设置模块http://localhost:5280/admin/server/localhost/node/[email protected]/modules/

enter image description here 为了使mod_registeretc/ejabberd文件夹更改ejabberd.yml文件。

enter image description here

而且我在ejabberd @本地

enter image description here

而且我用下面的代码注册用户点击端口。

NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"jabber:iq:register"]; 
     [query addChild:[NSXMLElement elementWithName:@"username" stringValue:@"syam"]]; 
     [query addChild:[NSXMLElement elementWithName:@"password" stringValue:@"[email protected]"]]; 
     NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"]; 
     [iq addAttributeWithName:@"type" stringValue:@"set"]; 
     [iq addAttributeWithName:@"id" stringValue:@"reg2"]; 
     [iq addChild:query]; 
     [APP_DELEGATE.xmppStream sendElement:iq]; 

     [APP_DELEGATE.xmppStream setHostName:@"0.0.0.0"]; 
     [APP_DELEGATE.xmppStream setHostPort:5222]; 
     NSError *error; 
     if (![APP_DELEGATE.xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]) { 
      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error connecting" 
                   message:@"See console for error details." 
                   delegate:nil 
                 cancelButtonTitle:@"Ok" 
                 otherButtonTitles:nil]; 
      [alertView show]; 
     } 

但是没有得到成功,发生在错误消息下面。

<iq xmlns="jabber:client" from="[email protected]" to="[email protected]/15505992182228745748626" type="error" id="reg2"><query xmlns="jabber:iq:register"><username>syam</username><password>[email protected]</password></query><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></service-unavailable><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">No module is handling this query</text></error></iq>

请帮我解决我的问题。

access: register表示 - 只有已经注册用户可以访问mod_register(例如更改密码)。您需要有access: all才能注册。而且不要忘了保护注册与验证码时,服务器将开放给公众网(在这种情况下,在XMPPFramework简单注册,即可实现将不够)

而且目前还不清楚是mod_register您的虚拟主机启用,检查mod_register存在在配置

+0

谢谢您的回答中modules:块,我已经做了“访问:所有”,但没有获得成功,有关CAPTCHA其可选的,但按你的建议,我会做到这一点。 – iPatel

+0

提到模块的更新答案config – vitalyster

+0

不,模块中没有mod_register:那么我哪里出错了?你能告诉我,因为我的.yml文件配置是正确的。 – iPatel