开发者

How to fetch twitter feeds in to iphone app?

开发者 https://www.devze.com 2023-03-06 00:12 出处:网络
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 :

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];
     }
0

精彩评论

暂无评论...
验证码 换一张
取 消