当前位置:编程学习 > wap >>

IOS开发

iOS 终端请求服务端数据时,
数据请求失败,出现这种错误,该怎么解决呢   急!!!!
Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0x8de87c0 {NSUnderlyingError=0x8deec80 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)", NSLocalizedDescription=A connection failure occurred}

那么该如何解决该问题呢?经过查找解决方案如下:
ios开发 解决方案 终端 --------------------编程问答-------------------- http://stackoverflow.com/questions/6082471/ios-development-why-do-i-always-get-the-a-connection-failure-occurred-on-the

这是ASIHttpRequest库的自身的一个问题,并不是你的代码问题。
问题出在并发性上,自动请求与主动请求冲突,导致返回值为nil。

解决看上面的博客吧,就是关闭ASIHttpRequest的持久连接。 --------------------编程问答-------------------- 用的是最新的ASIHttpRequest吗? --------------------编程问答--------------------
引用 2 楼 andy_123 的回复:
用的是最新的ASIHttpRequest吗?
是啊。。 --------------------编程问答--------------------
引用 2 楼 andy_123 的回复:
用的是最新的ASIHttpRequest吗?


A fix is to set persistentConnection to NO with your post requests like the following:

ASIHTTPRequest *req = [ASIHTTPRequest requestWithURL:url];
req.shouldAttemptPersistentConnection   = NO;
补充:移动开发 ,  iPhone
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,