【问题标题】:Developing RSS reader for iOS?为 iOS 开发 RSS 阅读器?
【发布时间】:2011-04-05 13:03:54
【问题描述】:

我喜欢制作一个从网站广告 RSS 或 JSON 读取文章的应用。我使用什么方法将 XML 或 JSON 抓取到我的应用程序?如何判断数据何时在本地可用?

谢谢。

编辑: 我在 iOS 上使用 Objective-c。我需要iOS代码。

【问题讨论】:

    标签: xml json sdk ios download


    【解决方案1】:

    您可能会在此tutorial from Gigaom 中得到一些提醒

    【讨论】:

      【解决方案2】:

      我不知道你使用什么编程语言,但我可以分享一个我用 C# 开发的代码 sn-p。它获取 wordpress 博客的 rss 内容,解析该内容,并显示 3 个热门博客文章链接。

      int blogitemcount = 3;
      string wordpressBlog = "wordpress blog address";
      System.Net.WebClient wc = new System.Net.WebClient();
      byte[] buffer = wc.DownloadData("http://" + wordpressBlog + "/feed/rss");
      wc.Dispose();
      wc = null;
      if(buffer.Length > 0) {
          string content = Encoding.UTF8.GetString(buffer);
          XmlDocument xdoc = new XmlDocument();
          xdoc.LoadXml(content);
          XmlNodeList nodes=xdoc.SelectNodes("/rss/channel/item");
          string linkformat = "<a href='{0}' target='_blank' class='blogitem'>{1}</a>";
          for(int i=0; i < nodes.Count && i < blogitemcount;i++ )
          {
              XmlNode n = nodes[i];
              this.ltItems.Text += string.Format(linkformat, n.SelectSingleNode("link").InnerText, n.SelectSingleNode("title").InnerText);
          }
      }
      

      【讨论】:

      • 谢谢。我正在为 ios 使用 Objective-c。
      猜你喜欢
      • 2015-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-06
      • 1970-01-01
      • 2012-08-09
      • 1970-01-01
      相关资源
      最近更新 更多