我使用iOS 5.0.1和iPhone 4s(也测试过4),使用Sudz-c生成的代码来连接我们的Web服务。该服务在WiFi上运行良好,但如果我尝试使用3g或EDGE连接,则无法正常工作。我收到以下错误信息: 即使在3g / edge上,它也从Safari加载url。
2012-01-15 18:32:13.987 SudzCExamples[487:707] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x18af60 {NSErrorFailingURLStringKey=http://sensored/app/soap/sensored/, NSErrorFailingURLKey=http://sensored/app/soap/sensored/, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x18afa0 "The request timed out."}
2012-01-15 18:32:13.988 SudzCExamples[487:707] Error: The request timed out.
SoapRequest中的url请求已收到响应。
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 有什么建议吗?
更新:如果我使用相同代码的其他服务器,它在3g上也可以很好地工作。看起来问题出在我们的服务器端代码上。有什么想法是什么原因?
更新2: 电话1:该应用程序仅通过wifi工作。(运营商:Sonera) 电话2:该应用程序仅通过wifi工作。(运营商:Sonera) 电话3:该应用程序仅通过wifi工作。(运营商:Sonera) 电话4:该应用程序在3g和wifi上都很好。(运营商:Elisa) iPad:该应用程序在3g和wifi上都很好。(运营商:Elisa)
如果我使用我们的服务与手机4一起使用,它也可以在3g上很好地工作。如果我将手机4的互联网连接共享给iPhone1(或2或3),则它将在该共享的wifi上工作,但不会在其自己的3g上工作。如果我将电话1(或2或3)连接共享到电话4,则它不会在电话4上的该共享wifi上工作。
我能注意到这些电话之间唯一的区别是电话1、2和3使用名为TeliaSonera的芬兰互联网服务提供商,而电话4使用Elisa。
更新3:我在iPhone模拟器中运行应用程序,它可以很好地工作。启动Charles代理后,它不再工作。请求成功发送到服务器,并实际上也给出了响应,即使应用程序失败。 以下是Charles Proxy软件显示的请求和响应:
POST /app/soap/sensored/ HTTP/1.1
Host: sensored
User-Agent: Sensored/1.0 CFNetwork/548.0.3 Darwin/11.2.0
Content-Length: 396
Accept: */*
SOAPAction: urn:sensoredSoapModelAction
Content-Type: text/xml; charset=utf-8
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=a60ef32d72121d625a95b75b90d48a22
Connection: keep-alive
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:sensored"><soap:Body><checkUpdates><authHash>daswwe12e2e2wweqwessd</authHash><lastCheckDate>2012-01-19 05:45</lastCheckDate></checkUpdates></soap:Body></soap:Envelope>
响应
HTTP/1.1 200 OK
Date: Thu, 19 Jan 2012 05:45:34 GMT
Server: Apache
X-Powered-By: PHP/5.3.2-1ubuntu4.11
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 537
Keep-Alive: timeout=5
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:sensored" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:checkUpdatesResponse><checkUpdatesReturn xsi:type="xsd:string">[dds2d,asddd2,a0333f,20dks]</checkUpdatesReturn></ns1:checkUpdatesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
概述
URL http://sensored/app/soap/sensored/
Status Complete
Response code 200 OK
Protocol HTTP/1.1
Method POST
Content-type text/xml; charset=utf-8
Client address /127.0.0.1
Remote Address sensored/177.33.83.129
Request Start time 19.1.2012 7:45:27
Request End time 19.1.2012 7:45:27
Response Start time 19.1.2012 7:45:28
Response End time 19.1.2012 7:45:33
Duration 5.77 sec
Request Duration 532 ms
Response Duration 4.99 sec
Latency 250 ms
Speed 0,24 KB/s
Response speed 0,13 KB/s
Request Header Size 366 bytes
Response Header Size 400 bytes
Request Size 396 bytes
Response Size 272 bytes
Total size 1,40 KB (1434 bytes)
Request Compression -
Response Compression 49,3% (gzip)