【问题标题】:hpple html parse iphone sdk help?hpple html解析iphone sdk帮助?
【发布时间】:2011-03-10 05:29:02
【问题描述】:

我想解析 html.. 所以我找到了一些示例代码:http://blog.objectgraph.com/index.php/2010/02/24/parsing-html-iphone-development/ 它使用 hpple 来解析 html ......但是由于某种原因,这个应用程序经常崩溃,很可能是这里的这一行:

NSURL *url = [NSURL URLWithString: @"http://www.objectgraph.com/contact.html"];
NSString *contents = [NSString stringWithContentsOfURL:url];
NSData *htmlData = [contents dataUsingEncoding:NSUTF8StringEncoding];

xCode 给我警告 stringWithCONtentsofVariable 已弃用..

所以任何人都可以帮助我解决这个问题....通过显示我应该更改哪些代码?

谢谢

【问题讨论】:

    标签: iphone html-parsing deprecated hpple


    【解决方案1】:

    the documentation 显示 30 秒:

    返回通过从给定 URL 命名的文件中读取数据创建的字符串。 (在 Mac OS X v10.4 中已弃用。请改用 stringWithContentsOfURL:encoding:error:stringWithContentsOfURL:usedEncoding:error:。)

    所以,看来您应该改用 stringWithContentsOfURL:encoding:errorstringWithContentsOfURL:usedEncoding:error:

    就像文档说的那样。

    【讨论】:

      猜你喜欢
      • 2011-02-21
      • 2011-02-26
      • 2013-12-21
      • 1970-01-01
      • 2015-09-27
      • 1970-01-01
      • 1970-01-01
      • 2013-02-17
      • 2013-04-15
      相关资源
      最近更新 更多