我想在我的iphone应用程序中从twitter获取Twitter提要。
我该怎么做?
答案 0 :(得分:0)
URLPath是一个格式为的字符串: 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];
}