2011-06-30 21 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]和我的密碼進行登錄,並且完美無瑕。

希望這可以幫助別人:-)

從你的描述