使用 httpClient (appcelerator) 进行多个请求
使用 appcelerator,我尝试使用 twitpic 演示发送图片,我创建了 2 个文本字段,当它们填写完毕后,我想将图像和这些字段上传到 twitpic。
该应用程序的问题是,在我第一次成功完成之后(没有关闭应用程序)第二次没有发送。
我需要以某种方式重置 httpClient 打开,以便它重新打开它。
这是我的代码 要点代码
With appcelerator, I am attempting to send a picture with the twitpic demo, I have created 2 text fields and when they are filled in I want to upload the image and those fields to twitpic.
The problem with the app, is after I do it successfully the first time, (without closing the app) the second time doesn't send.
I need to somehow reset the httpClient open so it will re-open it.
Here is my code gist code
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将 xhr.abort() 添加到 updateSuccess 函数的末尾以首先关闭打开的连接
You could add xhr.abort() to the end of you updateSuccess function to close the open connection first
我遇到了同样的问题,并决定在每次发出请求时创建一个新的 HttpClient。
I had the same problem, and resolved to creating a new HttpClient every time I make a request.