美文网首页
xmpp错误新解<failure xmlns="

xmpp错误新解<failure xmlns="

作者: neobuger | 来源:发表于2018-03-07 09:42 被阅读272次

最近调试xmpp,用于视频的甩屏功能,出现了xmpp能够连上服务器,但是无法登陆认证的问题
就是

表示xmpp服务器链接成功
- (void)xmppStreamDidConnect:(XMPPStream *)sender ;

但是会走

xmpp登录失败
- (void)xmppStream:(XMPPStream *)sender didNotAuthenticate:(NSXMLElement *)error;

查看error信息是:

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

网上搜索此类错误信息都是 domain设置问题.
但是跟服务器那边测试是没有问题的,安卓是能够调通的.

后来抓取日志看到

设置xmppjid的时候使用的账号明明是小写,但是在服务器那边接收到的是大写

打断点看到
XMPPJID这个类里有个

将账号转换成大写的方法
- (NSString *)user
{
    return [user uppercaseString]; // Why didn't we just synthesize this? See comment above.
}

将此方法修改直接返回user后 问题解决!!!

原来以前安卓也遇到过此类问题.. - -!

为什么会将账号大写呢?

未完待续...

相关文章

网友评论

      本文标题:xmpp错误新解<failure xmlns="

      本文链接:https://www.haomeiwen.com/subject/yindfftx.html