#pragma mark-wrong password, authentication failed-(void) Xmppstream: (Xmppstream *) sender Didnotauthenticate: (ddxmlelement *) Error { NSLog (@ " authentication failed%@", error);} //<failure xmlns= "URN:IETF:PARAMS:XML:NS:XMPP-SASL" ><not-authorized></not-authorized> </failure>
Cause: Incorrect user name configuration
nsstring *username = @ "tqhtest "; NSString *hostname = @ "127.0.0.1 "; //3. Xmppstream and host Settings Jid // [_xmppstream Setmyjid:[xmppjid jidwithstring: UserName]]; //@127.0.0.1 [_xmppstream Setmyjid:[xmppjid Jidwithuser:username domain:@ "127.0.0.1 " Resource:nil]"; [_xmppstream Sethostname:hostname];
In fact, the XMPP authentication problem, is generally related to Jid, so solve this kind of problem, the first choice is to analyze the Xmppstream Jid, the client after connecting with the server, the socket is bound to the port, to handle the round-trip data with the server, Certification is one of them. And, often we are connected to the server, in order to be simple, often use localhost or 127.0.0.1来 as part of the domain name, this time to pay particular attention, because when using spark or other client program login, use such domain name login service Server is not a problem, but in the code to deal with special care, be sure to in the back of the servers, confirm the domain name unification:
Fill in your domain
XMPP Common Error One