iPhone XML/JSON 请求中的请求超时
这是处理请求超时的最佳方法。我正在发送 XML 请求,如果在 10 秒内没有得到响应,我需要停止活动指示器并显示警报消息。
哪种方法最好:
以下 NSTimer - 检查响应的状态
b. NSThread - 这将在后台运行以检查响应
c。通知类(我从未使用过)
谢谢
Which is the best way to handle request-timeout. I am sending XML request and if I didn't get response in 10 sec I need to stop activity indicator and show alert message.
Which approach is best out of following:
a. NSTimer - To check status of response
b. NSThread - This will run in background to check response
c. Notification class (I never used it)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 NSMutableURLRequest 那么您可以在此给出时间间隔,
例如。
所以不需要使用定时器或线程
If you use NSMutableURLRequest then you can give time interval in this
for eg.
so no need to use timer or thread