2016-08-29 45 views
10

寄存器我是新的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>

請幫我解決我的問題。

回答

1

access: register表示 - 只有已經註冊用戶可以訪問mod_register(例如更改密碼)。您需要有access: all才能註冊。而且不要忘了保護註冊與驗證碼時,服務器將開放給公衆網(在這種情況下,在XMPPFramework簡單註冊,即可實現將不夠)

而且目前還不清楚是mod_register您的虛擬主機啓用,檢查mod_register存在在配置

+0

謝謝您的回答中modules:塊,我已經做了「訪問:所有」,但沒有獲得成功,有關CAPTCHA其可選的,但按你的建議,我會做到這一點。 – iPatel

+0

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

+0

不,模塊中沒有mod_register:那麼我哪裏出錯了?你能告訴我,因爲我的.yml文件配置是正確的。 – iPatel