开发者

hpple html parse iphone sdk help?

I want to parse html.. so I have found some sample code over: http://blog.objectgraph.com/index.php/2010/02/24/parsing-html-iphone-development/ it uses hpple to parse html... but there is one problem this application is constantly crashing for some reason most probably it is this line over here:

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

xCode gives m开发者_Python百科e warning stringWithCOntentsofVariable is deprecated..

so could anyone help me solve this problem....by showing what code should I change?

thanks


30 seconds in the documentation shows:

Returns a string created by reading data from the file named by a given URL. (Deprecated in Mac OS X v10.4. Use stringWithContentsOfURL:encoding:error: or stringWithContentsOfURL:usedEncoding:error: instead.)

So, it looks like you should be using stringWithContentsOfURL:encoding:error or stringWithContentsOfURL:usedEncoding:error: instead.

Just like the documentation says.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜