Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-25-2011, 05:26 PM   #1 (permalink)
-10
Registered Member
 
Join Date: Apr 2011
Posts: 3
-10 is on a distinguished road
Default Pull posts from Twitter hashtag into app?

Hi all,

I've got a screen in an iPhone app and I want to periodically pull a twitter feed from a hashtag and display it in a UIScrollView as plain text (bold name). Don't need the ability to interact or post to Twitter from the app, just need to pull the feed.

I'm fairly new to XCode, can anyone help me out with this? Hand-holding would be really nice. I downloaded TouchXML but don't know the syntax to pull the XML file or where to get it from, much less how to parse it.

I also have another UIScrollView which I want to pull the titles of blog posts and dates from an RSS feed. If anyone could help with these two I'd be eternally grateful.
-10 is offline   Reply With Quote
Old 04-25-2011, 11:49 PM   #2 (permalink)
Beast Mode
 
Join Date: Dec 2008
Age: 21
Posts: 1,971
Bertrand21 is on a distinguished road
Default

Quote:
Originally Posted by -10 View Post
Hi all,

I've got a screen in an iPhone app and I want to periodically pull a twitter feed from a hashtag and display it in a UIScrollView as plain text (bold name). Don't need the ability to interact or post to Twitter from the app, just need to pull the feed.

I'm fairly new to XCode, can anyone help me out with this? Hand-holding would be really nice. I downloaded TouchXML but don't know the syntax to pull the XML file or where to get it from, much less how to parse it.

I also have another UIScrollView which I want to pull the titles of blog posts and dates from an RSS feed. If anyone could help with these two I'd be eternally grateful.
Look up the Twitter API.

The problem is the XML libraries wont be much help because the Twitter API uses JSON.
__________________
Haters gonna Hate
Likers gonna Like
Bertrand21 is offline   Reply With Quote
Old 04-26-2011, 01:50 AM   #3 (permalink)
mr.
 
refreshe's Avatar
 
Join Date: Jul 2008
Location: SF, California | Melbourne, Australia
Posts: 346
refreshe is on a distinguished road
Default

Twitter search API supports both JSON and Atom (XML). JSON would be easiest to work with though (using JSON framework).
I'm assuming you just want to pull in a search feed for a hashtag. I'd point you to the Twitter API (which you should investigate), but since your needs are quite basic, the API call would be along the lines of:
http://search.twitter.com/search.json?q=%23iphone (note the url encoded #)

Here's a very simple example that will fetch the search feed for #iphone and print out the tweets using JSON:

Code:
    NSString *jString = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://search.twitter.com/search.json?q=%23iphone"]];
    
    NSArray *tweets = [[jString JSONValue] objectForKey:@"results"];
    
    for (NSDictionary *tweet in tweets) {
        NSLog(@"%@: %@", [tweet objectForKey:@"from_user"], [tweet objectForKey:@"text"]);
        //prints user: tweet
    }
    [jString release];

With regards to dealing with RSS parsing, there are plenty of examples for XML parsing around. Give it a go and post specific problems you encounter. It's a bit consuming to try and explain it when there are great resources already around (a quick forum search here will probably give you some useful threads). You don't necessarily have to use TouchXML. Built in NSXMLParser should be plenty fine and you'll find more examples and documentation using that.
refreshe is offline   Reply With Quote
Old 04-26-2011, 10:30 AM   #4 (permalink)
-10
Registered Member
 
Join Date: Apr 2011
Posts: 3
-10 is on a distinguished road
Default

Thank you very much, I'll have a try with this and see how far I get. Understand that hand-holding is a pain (I've done it to get other people into PHP, can be like pulling teeth), and thanks for your help.
-10 is offline   Reply With Quote
Old 04-26-2011, 04:12 PM   #5 (permalink)
-10
Registered Member
 
Join Date: Apr 2011
Posts: 3
-10 is on a distinguished road
Default

Is there a way to make it only pull 10 at a time?
-10 is offline   Reply With Quote
Old 04-26-2011, 04:19 PM   #6 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

GET search | dev.twitter.com Do some reading, the extra parameters are there that you need to add to limit the search results.
smithdale87 is offline   Reply With Quote
Reply

Bookmarks

Tags
feed, iphone, twitter, xcode, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 350
11 members and 339 guests
dansparrow, iOS.Lover, lorrettaui53, Nobbsy, oztemel, pbart, PlutoPrime, samdanielblr, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,897
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:51 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0