0

簡単な質問があります。iOSアプリにTwitter検索APIがあります。代わりに、ハッシュタグとユーザータイムラインの検索を実装したいと考えています。ハッシュタグの場合、次のURLがあります: http://search.twitter.com/search.json?q =%23HASHTAGHEREしかし、ユーザーのタイムラインのJSONURLが見つかりませんでした。誰かが私にこれを指摘することができれば、それは素晴らしいことです。ありがとうございました

ハッシュの現在:

NSString *urlString = [NSString stringWithFormat:@"http://search.twitter.com/search.json?q=&ands=%@&phrase=&rpp=50",searchTerm];
  NSURL *url = [NSURL URLWithString:urlString];       //Setup and start async download    

NSURLRequest * request = [[NSURLRequest alloc] initWithURL:url]; NSURLConnection * connection = [[NSURLConnection alloc] initWithRequest:requestデリゲート:self];

4

1 に答える 1

1

ユーザーのタイムラインのURL:https ://api.twitter.com/1.1/statuses/user_timeline.json

ソース:https ://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

これはiOS5以降用であることに注意してください。TWRequest

    NSURL *getTimeline = [NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/user_timeline.json"];

    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
                               <twitter screen name goes here>, @"screen_name",
                                nil];

    TWRequest *twitterRequest = [[TWRequest alloc] initWithURL:getTimeline
                                                    parameters:parameters
                                                 requestMethod:TWRequestMethodGET];

//Set a twitter account (Gotten from iOS 5+)
    [twitterRequest setAccount:self.twitterAccount];

    [twitterRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
     {
         if (!error)
         {             
             JSONDecoder *decoder = [[JSONDecoder alloc] initWithParseOptions:JKParseOptionNone];
             NSArray *twitterTimeline = [decoder objectWithData:responseData];

         }
         else
         {
             //Deal with error
         }


     }];

認証などのないJSONタイムラインが必要な場合は、次を使用できます: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=(screen-name-here)

于 2013-03-25T05:38:13.390 に答える