How to get my last TWEET into an NSString in my iPhone app?
There are a bunch of tutorials online about how to use xmlparsers or what not to bring an entire twitter feed into a UITableView. Thats not what I need. I only want ONE tweet. The most recent twi开发者_如何转开发tter update.
So, would some of you geniuses please show me in detail how to get my last (most recent) TWEET into an NSString in my iPhone app?
In short: exactly the same as all those tutorials that you've read except you pass the count
parameter to the statuses/user_timeline
REST method.
Ohh, this is complicated, not so easy, I show you the steps:
- Make the request to the api (synchronous or asynchonous)
- Handle the Authentication Challenge for authenticated request
- Get the data, call the parse method of the parser
- Handle the delegation methods of the nsxmlparser
- Manually handle the DidStartElement, DidFoundCharacters, DidEndElement to get the first status you want, assign the string value to a variable when it founds the characters.
That's all you need to do ;)
Good luck.
精彩评论