How to fetch twitter feeds in to iphone app?
I want to fetch the twitter feeds from twitter in my iphone app.
开发者_Go百科How can I do it?
URLPath is a string with format : https://api.twitter.com/1.1/statuses/user_timeline.json?count=40&user_id=your_user_id&screen_name=screen_name_you_want
TWRequest *twRequest = nil;
NSURLRequest *postRequest = nil;
twRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:URLPath]
parameters:nil requestMethod:TWRequestMethodGET];
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *twitterAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
ACAccount *twitterAccount = [[accountStore accountsWithAccountType:twitterAccountType] objectAtIndex:0];
if (twitterAccount) {
twRequest.account = [accountStore accountWithIdentifier:((ACAccount *)twitterAccount).identifier];
postRequest = [twRequest signedURLRequest];
connectionRequest = [[NSURLConnection alloc] initWithRequest:postRequest delegate:self];
if(connectionRequest)
responseData = [[NSMutableData alloc] init];
}
精彩评论