2011-06-30 26 views
6

有没有办法在iOS上配置xmppframework以获得特定的认证机制?xmppframework(iOS)并配置认证类型

我在连接到与http://code.google.com/p/xmppframework样品iPhoneXMPP应用程序的服务器的Openfire麻烦,我知道我的JID,密码和主机名/端口都是正确的,但连接之后,我得到一个回调:

- (void)xmppStream:(XMPPStream *)sender didNotAuthenticate:(NSXMLElement *)error 

与相应的错误:

RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure> 

初始握手之后,我接收委托回调

- (void)xmppStreamDidConnect:(XMPPStream *)sender 
{ 
     if (![[self xmppStream] authenticateWithPassword:password error:&error]) 
      DDLogError(@"Error authenticating: %@", error); 
} 

XMPStream类的authenticateWithPassword方法:

- (BOOL)authenticateWithPassword:(NSString *)password error:(NSError **)errPtr 
{ 
... 
// Reaches here and we get back a 'YES' because the server reports that one of the 
// supported mechanisms by 'stream:features' is DIGEST-MD5 

if ([self supportsDigestMD5Authentication]) 
{ 
    // send the digest data along with with password 
} 
... 

我有点新本,所以我也许问错了问题。请指出正确的方向。

回答

2

确定我在iPhone客户端中输入了错误的用户名。我使用了OpenFire服务器(在本地DNS命名空间mba.fritz.box)设置了一个名为'germanuser'的用户,并尝试使用我的用户名登录,该用户名并未如所述那样工作。当我尝试用我的电子邮件地址登录时,我看到@符号后面的部分被考虑到了。因此,我尝试使用[email protected]和我的密码进行登录,并且完美无瑕。

希望这可以帮助别人:-)

从你的描述