开发者

Appcelerator. Connection problems now and then

Titanium SDK version: 1.7.0.RC1 iPhone SDK version: 4.2

I am developing an iOS app in Titanium that is communicating with an API build using Rails 3. Now and then I get the below error when trying to connect to the API. This happens 4 out of 10 times I do it which is very frustrating. What is the problem?

Error:Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0x6cb5840 {NSUnderlyingError=0x6c204开发者_如何学编程30 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)", NSLocalizedDescription=A connection failure occurred}

This is my complete CRUD-file: http://pastie.org/1915340.

Does any one know of to fix it?

Thankful for all help!


I had the exact same problem uploading images and it was very frustrating. I wasn't sure if it was a server or titanium/iphone problem.

Try creating your HTTPClient like so. It solved the problem for me.

xhr = Titanium.Network.createHTTPClient({enableKeepAlive:false});

Here is more information about the issue:

http://developer.appcelerator.com/question/120964/sporadic-server-error-a-connection-failure-occurred

http://jira.appcelerator.org/browse/TC-79

Answer is probably too late for you, but hopefully it can help someone else.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜