English 中文(简体)
如何获得最新信息?
原标题:How to get the most updated tweet?

我正试图贴上前线,然后从时间表中拿到最新的信条,并找到刚刚张贴的图像。

但有些人却不向我表明最近的情况。 这部法律正在使用:

-(void)shareButtonClicked:(id)sender
{
    if ([TWTweetComposeViewController canSendTweet]) 
    {
        // Create account store, followed by a twitter account identifier
        // At this point, twitter is the only account type available
        ACAccountStore *account = [[ACAccountStore alloc] init];
        ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

        // Request access from the user to access their Twitter account
        [account requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) 
         {
             // Did user allow us access?
             if (granted == YES)
             {
                 // Populate array with all available Twitter accounts
                 NSArray *arrayOfAccounts = [account accountsWithAccountType:accountType];

                 // Sanity check
                 if ([arrayOfAccounts count] > 0) 
                 {
                     // Keep it simple, use the first account available
                     ACAccount *acct = [arrayOfAccounts objectAtIndex:0];


                     // Build a twitter request
                     UIImage * image = [UIImage imageNamed:@"welcomescreen-header.png"];
                     NSString * status = @"This is welcome screen.";
                     NSString * completeHandle = [NSString stringWithFormat:@"%@@%@",status,twitterHandle.text];

                     NSData * data=[completeHandle dataUsingEncoding:NSUTF8StringEncoding];
                     NSLog(@"Text:%@",completeHandle);
                     NSData * imageData = (UIImageJPEGRepresentation(photo.image, 90));


                     TWRequest *postRequest = [[TWRequest alloc] initWithURL:
                                               [NSURL URLWithString:@"https://upload.twitter.com/1/statuses/update_with_media.json"] 
                                                                  parameters:nil requestMethod:TWRequestMethodPOST];
                     [postRequest addMultiPartData:imageData withName:@"media" type:@"image/jpeg"];
                     [postRequest addMultiPartData:data withName:@"status" type:@"text"];

                     // Post the request
                     [postRequest setAccount:acct];

                     // Block handler to manage the response
                     [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) 
                      {
                          NSLog(@"Twitter Response, HTTP response: %i", [urlResponse statusCode]);
                          if ([urlResponse statusCode] == 200) {
                              [self getTheUserTimeLine];

                          }
                      }];
                 }
             }
         }];
    }
}

-(void)getTheUserTimeLine

{
    TWRequest *postRequest = [[TWRequest alloc] initWithURL:
                              [NSURL URLWithString:@"https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=ashu1702&count=1"] 
                                                 parameters:nil requestMethod:TWRequestMethodGET];

    // Block handler to manage the response
    [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) 
     {
         if ([urlResponse statusCode] == 200) 
         {
             // The response from Twitter is in JSON format
             // Move the response into a dictionary and print
             NSError *error;        
             NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&error];
             NSLog(@"Twitter response: %@", [dict description]);                           
         }
         else
             NSLog(@"Twitter error, HTTP response: %i", [urlResponse statusCode]);
     }];
}
问题回答

Try using http://twitter.com/statuses/user_timeline/ashu1702.json?count=1 in their browser and see whatpractics. 我早就读过你的法典,但现在我看上去了。





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签