2013-10-11 3 views
0

트위터 통합과 비공개 트윗에 관한 많은 것들이 있습니다. 하지만 iOS7에서 TWRequest을 사용하면 작동 여부가 궁금합니다.ios7에서 개인 트윗을 얻는 방법?

My code snippet as follows. 
ACAccountStore *accountStore = [[ACAccountStore alloc] init]; 

    ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; 

    [accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error){ 
     if(granted) 
     { 
      // Get the list of Twitter accounts. 
      NSArray *accountsArray = [accountStore accountsWithAccountType:accountType]; 

      // For the sake of brevity, we'll assume there is only one Twitter account present. 
      // You would ideally ask the user which account they want to tweet from, if there is more than one Twitter account present. 
      if ([accountsArray count] > 0) { 
       // Grab the initial Twitter account to tweet from. 
       ACAccount *twitterAccount = [accountsArray objectAtIndex:0]; 

       NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] init]; 
       [tempDict setValue:@"rohit40793982" forKey:@"screen_name"]; 
       //[tempDict setValue:@"true" forKey:@"follow"]; 
       // [tempDict setValue:@"683286" forKey:@"user_id "]; 

       TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"https://twitter.com/snehalikanksha/status/388535072359317504.json"] 
                  parameters:tempDict 
                  requestMethod:TWRequestMethodPOST]; 


       [postRequest setAccount:twitterAccount]; 

       [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) 
       { 
        NSLog(@"%@",urlResponse); 
        NSArray *tweets = [NSJSONSerialization JSONObjectWithData:responseData 
                     options:kNilOptions 
                     error:&error]; 
        NSLog(@"%@",tweets); 
        NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]]; 
        NSLog(@"%@", output); 
        [self performSelectorOnMainThread:@selector(displayText) withObject:output waitUntilDone:NO]; 

       }]; 
      } 
     } 
    }]; 

아무도 도와 줄 수 있습니까? 이 Http 오류 403 및 로그 쇼

"Your account may not be allowed to perform this action. Please <a class=\"js-reload\" href=\"#\">refresh the page</a> and try again." 

답변

0

난 당신이 뭘 하려는지 모르겠어요하지만 코드가 작동하지 않는 이유는 당신이 Twitter API를 사용하지 않을 것입니다을 제공합니다 엔드 포인트.

특정 트윗의 세부 정보를 얻으려면 GET statuses/show/:id을 사용할 수 있습니다.

당신을 위해 코드를 변경해야합니다 :

NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/show.json?id=388535072359317504"]; 

TWRequest *request = [[TWRequest alloc] initWithURL:url 
             parameters:nil 
             requestMethod:TWRequestMethodGET]; 

STTwitter library는 오브젝티브 C의 방법으로 모든 엔드 포인트를 매핑하여 API를 사용하는 데 도움이 될 수 있습니다.

+0

안녕하세요, 지금 작동 중입니다. –

관련 문제