1

So, the twitter API has the method "statuses/update":

URL:
http://twitter.com/statuses/update.format

Formats: 
xml, json, rss, atom 

HTTP Method(s):
POST

Requires Authentication (about authentication):
true

API rate limited (about rate limiting):
false

Parameters:

    * status.  Required.  The text of your status update. URL encode as necessary. Statuses over 140 characters will be forceably truncated.
    * in_reply_to_status_id.  Optional. The ID of an existing status that the update is in reply to.

How would you call this method with objective-c (iphone)?

sol
  • 601
  • 2
  • 10
  • 16
  • Are you using any json (or other) library to communicate with twitter server or are you trying manually build the urls? – stefanB Jul 08 '09 at 07:06
  • there's already a nice twitter library for the iphone. google! – Ben Gotow Jul 08 '09 at 07:13
  • There are no nice twitter libraries that use Oauth. If you're talking about MGTwitterEngine, it doesn't use OAuth, and that's what twitter is requiring now. – sol Jul 09 '09 at 02:46
  • While you're right to have an eye on the future, Twitter doesn't currently require OAuth and they have not announced any plans to phase out basic authentication, though that is the intention longer-term. – Stephen Darlington Jul 09 '09 at 11:04
  • without using OAuth the tweet will say "from MGTwitterEngine" instead of your own app's name. And if the owner of MGTE disables the token your app stops working. – sol Jul 10 '09 at 04:40
  • Not true. You just need to set the correct token: http://stackoverflow.com/questions/1064970/iphone-mgtwitterengine-post-a-tweet-with-my-app-signature – Stephen Darlington Jul 27 '09 at 10:01
  • My comments above are now incorrect. Twitter will be phasing out basic auth very shortly. And to get your apps name you do need to use OAuth. – Stephen Darlington Jul 13 '10 at 21:55

2 Answers2

8

Rather than implementing the API on your own, you might prefer to use a Cocoa framework that has already been written. There are a few, but the most commonly used (as far as I can tell) is MGTwitterEngine.

If you do want to do it by hand, you would use NSURLConnection to download the data and then whatever you need to parse the output (NSXMLParser for XML, a bit harder for JSON).

Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
  • I have seen your comment on above. Now, I am trying to validate TWitter account via OAuth. is this possible to do that? and also I am struggling with implement an OAuth in my apps for last two weeks. please guide me! – Sivanathan Jul 13 '10 at 11:40
  • The top two Google results for "MGTwitterEngine OAuth" should help. There's also another StackOverflow question about using MGTwitterEngine with OAuth: http://stackoverflow.com/questions/1965218/twitter-oauth-with-mgtwitterengine – Stephen Darlington Jul 13 '10 at 21:58
5

Look around for either twitter or json to objective-c libraries to communicate with twitter There's a JSON framework with iPhone SDK 2.2 as an example.

There's a iPhone dev course at Stanford on iTunes, they were working on Twitter app which included examples of how to get data from Twitter. Google around.

stefanB
  • 77,323
  • 27
  • 116
  • 141