Reputation: 4652
Any starter material on using Twitter framework in iOS 5, I intend to view tweets from users
Upvotes: 0
Views: 802
Reputation: 2997
In latest release apple provide Twitter Framework, you can refer documentation
And for sample source code
This sample demonstrates the built-in Twitter composition sheet, creating a POST request, and parsing returned data.
Upvotes: 1
Reputation: 2201
This is a mock-up of what you need in .NET. I'm sure you'll be able to translate it to objective-c, or whatever it is you're working in. Basically, the XML file is what you need.
string userName;
WebClient client;
XDocument document;
ObservableCollection<Tweet> tweetList;
tweetList = new ObservableCollection<Tweet>();
client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync(new Uri("http://twitter.com/statuses/user_timeline/" + userName + ".xml"));
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
document = XDocument.Parse(e.Result);
foreach (XElement tweet in document.Descendants("status"))
{
Tweet temp = new Tweet();
temp.Name = tweet.Element("user").Element("name").Value;
temp.Image = tweet.Element("user").Element("profile_image_url").Value;
temp.Text = tweet.Element("text").Value;
temp.Date = tweet.Element("created_at").Value.Substring(0, 11);
tweetList.Add(temp);
}
}
}
Upvotes: 0