Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从网站抓取数据_Ios - Fatal编程技术网

Ios 从网站抓取数据

Ios 从网站抓取数据,ios,Ios,我只是想知道你将如何从BBC获取文章,并在iOS应用程序中自动更新这些信息。所以基本上,我想做的是在BBC发布新文章时自动向我的应用程序中添加新文章。这可能吗?是的,您可以通过从他们的RSS源获取信息来实现这一点 它将返回一个XML文档,您可以解析它并在应用程序中显示它们 示例文章信息 <title>US boy charged in death of teacher</title> <description>A 14-year-old bo

我只是想知道你将如何从BBC获取文章,并在iOS应用程序中自动更新这些信息。所以基本上,我想做的是在BBC发布新文章时自动向我的应用程序中添加新文章。这可能吗?

是的,您可以通过从他们的RSS源获取信息来实现这一点

它将返回一个XML文档,您可以解析它并在应用程序中显示它们

示例文章信息

  <title>US boy charged in death of teacher</title>
      <description>A 14-year-old boy has been charged in the death of a teacher whose body was found in woodland behind her school.</description>
      <link>http://www.bbc.co.uk/news/world-us-canada-24644203#sa-ns_mchannel=rss&amp;ns_source=PublicRSS20-sa</link>
      <guid isPermaLink="false">http://www.bbc.co.uk/news/world-us-canada-24644203</guid>
      <pubDate>Wed, 23 Oct 2013 19:03:05 GMT</pubDate>
      <media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/70673000/jpg/_70673073_chism.jpg"/>
      <media:thumbnail width="144" height="81" url="http://news.bbcimg.co.uk/media/images/70673000/jpg/_70673074_chism.jpg"/>
    </item>
美国男孩被控教师死亡
一名14岁男孩被指控在学校后面的林地发现一名教师的尸体。
http://www.bbc.co.uk/news/world-us-canada-24644203#sa-ns_mchannel=rss&;ns_来源=PublicRSS20 sa
http://www.bbc.co.uk/news/world-us-canada-24644203
2013年10月23日星期三19:03:05 GMT

这很简单。。获取本教程中的示例代码

在APPMasterViewController.m中,将url更改为

NSURL *url = [NSURL URLWithString:@"http://feeds.bbci.co.uk/news/rss.xml”];

您可以从他们的页面获取其他类型的新闻源

从以下链接查看开发人员的API:

http://www.bbc.co.uk/developer/technology/apis.html
抓取api并解析日期——在我看来,JSON是iOS上最合适的格式


然后,您可以将新解析的数据与设备上的数据进行比较,并检查是否有新的内容。

谢谢,我会尝试的tomorrow@avi每次用户打开或刷新视图以获取新数据时,都需要获取rss.xml。