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 09-02-2010, 03:18 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 54
bebus77 is on a distinguished road
Default New twitter implementation

Hey guys,

I'm building apps that need to get the last tweet of a certain user, I was easily using the MGTwitterEngine, and everything worked really fine but since two days ago twitter has changed pretty everything and the basic authentication is no more allowed for third party apps, and MGTwitterEngine doesn't seem to be working anymore or maybe in the way I used to use it.

Now I am asking you, what's the simplest way to get just the last tweet ?

I am viewing some oauth and xauth code for iphone and they seem to be pretty complicated, have you got something else ?

any guide ?

Thank you so much for the answers
bebus77 is offline   Reply With Quote
Old 09-02-2010, 06:10 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

The latest MGTwitterEngine has support for X/OAuth. Try downloading the most recent version from Github.

Last edited by harrytheshark; 09-02-2010 at 06:42 PM. Reason: SPELLING!!!!!!!
harrytheshark is offline   Reply With Quote
Old 09-02-2010, 06:22 PM   #3 (permalink)
Elegance is Infinite
iPhone Dev SDK Supporter
 
TapTouchClick's Avatar
 
Join Date: Jan 2010
Location: Bay Area, CA
Posts: 677
TapTouchClick is on a distinguished road
Send a message via AIM to TapTouchClick Send a message via Skype™ to TapTouchClick
Default

if you JUST want the last tweet, your safest bet is to screenscrape the RSS or Screen.
__________________
Our website
TapTouchClick is offline   Reply With Quote
Old 09-02-2010, 06:42 PM   #4 (permalink)
mr.
 
refreshe's Avatar
 
Join Date: Jul 2008
Location: SF, California | Melbourne, Australia
Posts: 346
refreshe is on a distinguished road
Default

Probably shouldn't scrape the site, but it's quite simple through the API.
If all you're doing with twitter is just getting someone's last tweet, you can simply make an anonymous API call since that type of call doesn't require Authentication (provided that user's timeline isn't protected);

Example using json:

Code:
{
    NSString *url = @"http://api.twitter.com/1/statuses/user_timeline.json?screen_name=conanobrien&count=1";
    NSString *jsonString = [NSString stringWithContentsOfURL:[NSURL URLWithString:url] encoding:NSUTF8StringEncoding error:NULL];
    NSArray *results = [jsonString JSONValue];

    NSString *tweet = [[results objectAtIndex:0] objectForKey@"text"]];
}
__________________
appz
refreshe is offline   Reply With Quote
Old 09-02-2010, 06:43 PM   #5 (permalink)
Elegance is Infinite
iPhone Dev SDK Supporter
 
TapTouchClick's Avatar
 
Join Date: Jan 2010
Location: Bay Area, CA
Posts: 677
TapTouchClick is on a distinguished road
Send a message via AIM to TapTouchClick Send a message via Skype™ to TapTouchClick
Default

aha! Forgot about Json :/ The guy above is 100% right.
__________________
Our website
TapTouchClick is offline   Reply With Quote
Old 09-02-2010, 09:23 PM   #6 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 138
rrichar is on a distinguished road
Default

Can someone example to me what json is. I want to do the samething. Post a certain user's twitter posts.
rrichar is offline   Reply With Quote
Old 09-03-2010, 05:45 AM   #7 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 54
bebus77 is on a distinguished road
Default

Quote:
Originally Posted by refreshe View Post
Probably shouldn't scrape the site, but it's quite simple through the API.
If all you're doing with twitter is just getting someone's last tweet, you can simply make an anonymous API call since that type of call doesn't require Authentication (provided that user's timeline isn't protected);

Example using json:

Code:
{
    NSString *url = @"http://api.twitter.com/1/statuses/user_timeline.json?screen_name=conanobrien&count=1";
    NSString *jsonString = [NSString stringWithContentsOfURL:[NSURL URLWithString:url] encoding:NSUTF8StringEncoding error:NULL];
    NSArray *results = [jsonString JSONValue];

    NSString *tweet = [[results objectAtIndex:0] objectForKey@"text"]];
}
Thank you so much ! everything is working perfectly !
bebus77 is offline   Reply With Quote
Old 09-04-2010, 01:10 PM   #8 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 138
rrichar is on a distinguished road
Default

Can someone help me out. I am making an App for my club. I t is a tab bar App. In one of the tabs I want to pull the twitter from a twitter account I created for my club. That why when I post events or meetings they can get it from the App. Can someone tell me what is the best way of doing so ? I am using PHONE SDK 4.00 and XCODE 3.2.3.
rrichar is offline   Reply With Quote
Old 09-04-2010, 07:55 PM   #9 (permalink)
mr.
 
refreshe's Avatar
 
Join Date: Jul 2008
Location: SF, California | Melbourne, Australia
Posts: 346
refreshe is on a distinguished road
Default

The snippet I posted above may be enough to accomplish what you're describing. You just need to include the json framework from json-framework - Project Hosting on Google Code in your project.
Then the results array can be used as the data source for a UITableView which displays the tweets.
__________________
appz
refreshe is offline   Reply With Quote
Old 09-04-2010, 09:33 PM   #10 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 138
rrichar is on a distinguished road
Default

Can I do this in a UIVIEW ?
rrichar is offline   Reply With Quote
Old 09-05-2010, 04:33 AM   #11 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

You can do it wherever you want.
harrytheshark is offline   Reply With Quote
Reply

Bookmarks

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: 347
7 members and 340 guests
dre, freewind, hain, HemiMG, lendo, mottdog, oceanlablight
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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