Appleå ¬å¼ã®ãµã³ãã«ãTweetingãã®ä¸å ·åã®ä¿®æ£æ¹æ³
Apple ã® Twitter ã使ããµã³ãã«ã Twitter API ã®ä»æ§å¤æ´ã§åããªãã£ã¦ãã¾ããã
å ·ä½çã¯ãGet Public Timelineãã®ãã¿ã³ãæ¼ããæã«æ£ããåä½ãã¾ããã
ä¿®æ£æ¹æ³
TweetingViewController.m ã®ä»¥ä¸ã®é¨åãåé¡ã¨ãªãé¨åã§ãã
- (IBAction)getPublicTimeline:(id)sender { // Create a request, which in this example, grabs the public timeline. // This example uses version 1 of the Twitter API. // This may need to be changed to whichever version is currently appropriate. TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/statuses/public_timeline.json"] parameters:nil requestMethod:TWRequestMethodGET];
ããã§ä½¿ç¨ãã¦ãã http://api.twitter.com/1/statuses/public_timeline.json ã¯ç¾å¨ã¯ä½¿ããªããªã£ã¦ããã®ã§çºçããã¨ã©ã¼ã§ãã
ãã®ãµã³ãã«ã§ã¯ãããªãã¯ã¿ã¤ã ã©ã¤ã³ãåå¾ãã¦ãã¾ãããããªãã¯ã¿ã¤ã ã©ã¤ã³ã¯Streaming APIãªã®ã§ä»£ããã«ãã©ãã¼ãã¦ãå人ã®IDãªã¹ããåå¾ããæ§ã«ãã®æ§ã«å¤æ´ãã¾ããã
// Create a request, which in this example, grabs the public timeline. // This example uses version 1 of the Twitter API. // This may need to be changed to whichever version is currently appropriate. NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: @"nakamura001", @"screen_name", @"-1", @"cursor", nil]; TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/friends/ids.json"] parameters:params requestMethod:TWRequestMethodGET];
ããã§ãGet Public Timelineããã¿ããããæã«ãã¼ã¿ãåå¾ã§ãã¾ãããã¾ããåå¾åºæ¥ããã¼ã¿ã¯ Public Timeline ãããªãã§ããw
é¢é£æ å ±
API requests with TWRequest | Twitter Developers
https://dev.twitter.com/docs/ios/making-api-requests-twrequest