如何在 Objective-C 中实现网站数据检索?
我想用 Objective-c 编写一个程序,从网站上获取一些体育统计数据,并将它们存储起来,以便我可以对它们进行一些统计分析。我对 Objective-C 有一点经验,但最近一直在使用 Java,已经忘记了 Objective-C 语言的很多基本组织。
我想知道是否有人可以推荐:
为此目的存储数据的最佳方式?
从网站获取数据的最佳方法以及我需要重写/实现哪些类才能做到这一点? 更具体地说:我想下载网站的内容,并筛选 HTML 代码,但不知道该怎么做。
我只是需要一个起点,因为我现在有点不知所措。预先感谢这个乐于助人且深思熟虑的社区,我期待成为其中的一员。
I want to write a program in Objective-c that grabs some sports stats off a website and stores them in such a way that I can run some statistical analysis on them. I have a little experience with objective-c but have been working with java more recently and have forgotten a lot of the basic organization of the objective-c language.
I was wondering if someone could recommend:
the best way to store data for this purpose?
the best way to go about getting data from the website and what classes I will need to override/implement to do this?
more specifically: I want to download the website's contents, and sieve through the HTML code, but am not sure how to go about this.
I just sort of need a starting point because I am a little overwhelmed right now. Thanks in advance to this helpful and thoughtful community, which I look forward to being a part of.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于大多数数据存储,即使您不需要将其存储在磁盘上,也值得使用核心数据,因为它可以非常方便地设计数据模型,并且可以省去很多数据管理工作。
至于从网站上获取数据,有很多因素会影响这一点。该网站在您的控制范围内吗?或者网站有什么API吗?或者是抓取网站并在 iPhone 端进行处理的情况?
for most data storage, its worth using core data, even if you don't need to store it on disc, as it can be very convenient for designing the data model, and gets a lot of the data management stuff out of the way.
as for getting the data off of the website, there are a lot of things that affect this. is the website within your control? or does the website have any kind of API? or is it a case of scraping the website, and processing at the iPhone side of things?
您需要的不仅仅是
[NSData dataWithContentsOfURL:url]
?Do you need something more than
[NSData dataWithContentsOfURL:url]
?