0

I've been researching the latest ways to integrate Twitter into my app and it appears the best (most painless) approach is to use the MGTwitterEngine, and the best tutorial I could find to implement this is a 3-part series. If all I need to do is allow the user to login to their twitter account and post a single tweet that's always the same, is there an easier way to do that than following the tutorial I linked to?

Thanks so much for your wisdom. If the alternatives aren't much easier, no problem, I'm not so lazy that I can't follow a tutorial, I was just wondering if there's a quicker way that I didn't see.

BeachRunnerFred
  • 18,070
  • 35
  • 139
  • 238

2 Answers2

2

Create a button that opens a UIWebView when clicked. Build the URL using details here: http://twitter.com/about/resources/tweetbutton. Simple - about 10 lines of code.

psychotik
  • 38,153
  • 34
  • 100
  • 135
  • thanks, psychotik. i assume the UIWebView is to allow the user to login? also, is there a way to confirm the tweet was actually posted? thanks again! – BeachRunnerFred Jan 22 '11 at 05:50
  • Well, there is but it's a little tricky. What you need to do is to display a UIWebView as a popup and set your class as the delegate. Then, you get callbacks before/after each page load and you can interpret the success/cancel URIs from Twitter. I don't have this code handy, but look as Facebook's open source iPhone SDK. It uses this trick -- just modify the URLs and you're good to go. – psychotik Jan 22 '11 at 08:34
1

I'm a big fan of st3fan's (Stefan Arentz) https://github.com/st3fan/iphone-twitter project. It's very easy to integrate and includes whole views that you can just use, easily customizable too.

Plan your Twitter implementation ahead - with an iPhone project you will want to use xAuth authentication which does not require a round trip to the web browser.* You have to first register your app and then request permission for your application to use this method. Check the Twitter developer pages for more details.

*or not. But I hate leaving the app to post tweets.

Community
  • 1
  • 1
Adam Eberbach
  • 12,309
  • 6
  • 62
  • 114
  • overkill for what he wants, IMO. – psychotik Jan 22 '11 at 08:35
  • The good thing about this solution is the user doesn't have to leave the app to post the tweet. The downside is it uses xAuth, which I have to request permission to use and I have no idea how long that will take to get, if ever. – BeachRunnerFred Jan 24 '11 at 01:24
  • I've done it for two apps. The first time it took two nights (I am in Australia) because I did not know exactly what to say. The second time overnight. – Adam Eberbach Jan 24 '11 at 22:33
  • @AdamEberbach i am getting this error Client application is not permitted to use xAuth. although i have provided `kOAuthConsumerKey` and `kOAuthConsumerSecret` whats problem here? and also this error `Request failed with status code 401` – Hrushikesh Betai Jun 12 '12 at 06:38