Common xmpp errors 1 and common xmpp errors
# Pragma mark-Incorrect 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> </failure>
Cause: the username configuration is incorrect.
NSString * userName = @ "tqhTest"; NSString * hostName = @ "127.0.0.1"; // 3. set JID and host of XMPPStream // [_ xmppStream setMyJID: [using jidWithString: userName]; // @ 127.0.0.1 [_ xmppStream setMyJID: [XMPPJID jidWithUser: userName domain: @ "127.0.0.1" resource: nil]; [_ xmppStream setHostName: hostName];
In fact, questions about XMPP authentication are generally related to JID. To solve this problem, the first choice is to analyze the JID of XMPPStream. After the client is connected to the server, socket is bound to this port to process round-trip data with the server. authentication is one of them. in addition, we often use localhost or 127.0.0.1 as the domain name for the sake of simplicity when we connect to the server. In this case, pay special attention to the following, when using Spark or other client programs to log on, using such a domain name to log on to the server is no problem, but you must be very careful when dealing with the code. You must be at the back of the server, confirm domain name unification:
Enter your own domain