ipad与服务器数据交互
我是 ipad 开发新手,我需要开发一个应用程序,需要从服务器获取数据然后将数据显示给用户。你能给我一些建议吗?如果您显示一些示例或文档链接,那就更好了。
I am new in ipad developing and I need to develop an app that need to get data from server then display the data to the user.Can you give me some advice? If you show some examples or documents link, that's better.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为十个初学者,从服务器获取数据的最常见方法是通过 NSString
stringWithContentsOfURL:encoding:error:
方法(以及 NSString 中的其他相关方法)和 NSURLConnection 类,该类能够执行异步后台操作请求。上述两个链接的类参考文档都包含代码示例(请参阅每个文档顶部的“相关示例代码”部分)。
此外,还有可用的第 3 方解决方案,例如常用的 ASIHTTPRequest 类。
在显示获取的数据方面,您确实需要更好地了解 iOS 编程来自己回答这个问题,因为它的范围太大,无法有意义地回答。但是,一个好的开始是 iOS 表格视图编程指南指南。
As a starter for ten, the most common means of fetching data from a server are via the NSString
stringWithContentsOfURL:encoding:error:
method (and other related methods in NSString) and the NSURLConnection class, which is capable of performing asynchronous background requests.Both of the above linked class reference documents contain code samples (see the "Related sample code" section at the top of each).
Additionally, there are 3rd party solutions available, such as the commonly used ASIHTTPRequest class.
In terms of the displaying the fetched data, you really need a better idea of iOS programming to answer this yourself, as it's too large in scope to meaningfully answer. However, a good start would be the Table View Programming Guide for iOS guide.