无法通过XMPPFramework在Jabberd中注册新用户帐户

时间:2015-12-02 14:24:18

标签: ios xmpp ejabberd

我在IOS中使用XMPPFrameWork尝试了一些新用户注册的代码。

(void)xmppStream:(XMPPStream *)sender didNotRegister:(NSXMLElement *)
error{ 
NSLog(@"Sorry the registration is failed");
NSLog(@"error: %@", error);
}

这是错误跟踪:

 XmppDemo[314:26961] Did not authenticate 2015-12-03 08:54:30.331 
 XmppDemo[314:26961] Sorry the registration is failed 2015-12-03 08:54:30.332 
 XmppDemo[314:26961] error: <iq xmlns="jabber:client" from="azlnx001" type="error">
                  <query xmlns="jabber:iq:register">
                    <username>26</username>
                    <password>123</password>
                  </quer??y>
                  <error code="403" type="auth">
                    <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></forbidden>
                  </error>
                </iq>

相关:

(void)xmppStream:(XMPPStream *)sender didNotAuthenticate: 
    (NSXMLElement *)error; { 
      NSLog(@"Did not authenticate"); NSError * err = nil; 
      if ( [self.xmppStream supportsInBandRegistration]) 
        { if(![self.xmppStream registerWithPassword:@"123" error:&err]) 
          { NSLog(@"Error registering: %@", err); } 
        } 
      } 

任何人都可以帮助我吗?

2 个答案:

答案 0 :(得分:0)

可能,用户注册未启用。如果您愿意,可以启用mod_register,如ejabberd文档中所述:http://docs.ejabberd.im/admin/guide/configuration/#modregister

请注意,它可能会产生垃圾邮件风险,因为它会自动创建帐户。

答案 1 :(得分:0)

ejabberd.yml

##
## Only clients in the server machine can register accounts
##
 ip_access: trusted_network

什么是trusted_network?我不知道配置trusted_network,所以我禁用它:

##
## Only clients in the server machine can register accounts
##
## ip_access: trusted_network 

我的应用可以注册新用户。非常好。