开发者

Getting text information from the Internet into my app

I learning Objective C, and I am going to develop some apps. I have a general question: How to get text information from the Internet into your app. Say you want the current title of Yahoo News. Do I need to use some PHP, or are there Objective-C specific classes to choose f开发者_开发知识库rom?

Help is appreciated (code as well!), just anything that can help me take te step to exploring the new possibilities!


If I understand your question, I'd say the best way to do it would be to get the HTML source from the URL of your choosing as a string, then parse it to grab an attribute such as the title. Have a look at NSString and NSXMLDocument; they both let you instantiate them from a URL.


Here's a great way to do it:

  1. Go to Yahoo Pipes, and create your "pipe" (basically a feed of one or many different data inputs on the web).

  2. Publish: Select a format for Yahoo to host, for example as an RSS feed or in JSON.

  3. UIWebView can then point to your pipe's URL. (Here's a tutorial on UIWebView)

Done.

Note that you can choose to get the feed as RSS, JSON, and other formats as well. Here is an example of a pipe I set up for the National Vulnerabilities Database as RSS, and the same feed as JSON.


ASIHttpRequest Will keep you sane.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜