6

有没有办法在 iOS 上为特定的身份验证机制配置 xmppframework?

我在使用来自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
}
...

我对此有点陌生,所以我可能问错了问题。请指出正确的方向。

4

2 回答 2

2

确定我在 iPhone 客户端中输入了错误的用户名。我使用 OpenFire 服务器(在本地 DNS 命名空间 mba.fritz.box 中)设置了一个名为“germanuser”的用户,并尝试使用我的用户名登录,但没有按描述工作。当我尝试使用我的电子邮件地址登录时,我看到 @ 符号后面的部分已被考虑。因此,我尝试使用 Germanuser@mba.fritz.box 和我的密码登录,这完美无缺。

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

于 2011-11-11T11:43:54.623 回答
0

很明显,从您的描述来看,您的帐号或密码是错误的。确保帐户完整,例如 name@example.com

于 2011-11-18T03:30:26.187 回答