iPad/objective-C同步HTTP请求示例?
我只能找到异步 iPad/objective C HTTP 示例。如何进行同步网络请求?
I can only find asynchronous iPad/objective C HTTP examples. How do I do a synchronous web request?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
同意 h4xxr,我会将您转发到
http://allseeing-i.com/ASIHTTPRequest/
是一个很棒的库,具有强大的同步和异步 HTTP 请求方法,并配有代码示例。
Agree with h4xxr and I would forward you to
http://allseeing-i.com/ASIHTTPRequest/
Which is a fantastic lib that has robust HTTP request methods for both synch and asynch complete with code samples.
取决于你想要什么数据。像这样简单的东西是同步的,并且有时很方便:(
字典也存在等价物)
在这种情况下,系统将等待来自 someaddress.asp 的响应 - 因此最好将这样的东西放入后台线程中。
如果您可以控制另一端的数据格式,这可能是一种将数据导入 iPhone/iPad 应用程序的快速而简单的方法...
编辑 - 只是想说明显而易见的事实通常异步通常是最好的!无需等待占用系统资源,特别是如果远程服务器已死亡等...:)
Depends on what data you're after. Something simple like this is synchronous, and is handy from time to time:
(Equivalent also exists for Dictionaries)
In this case, the system will wait for a response from someaddress.asp - therefore best perhaps to put something like this into a background thread.
If you have control over the format of the data at the other end, this can be a quick and easy way to get data into an iPhone/iPad app...
Edit - just wanted to state the obvious that typically asynchronous is usually best! No waiting around tying up system resources, especially if remote server has died etc... :)