2014-06-12 4 views
0

SLRequest를 사용하여 트위터 요청을하려고하는데 요청에 매개 변수가 포함될 때마다 응답은 {"errors":[{"message":"Could not authenticate you","code":32}]}입니다. 매개 변수를 포함하지 않으면 요청이 예상대로 작동합니다.매개 변수가있는 SLRequest를 사용하는 Twitter 요청의 오류 32

URL에 쿼리 문자열로 매개 변수를 포함 시키려고했지만 아무런 차이가 없습니다. "10"@ : 문자열로 전달하는 대신하려고 - 당신은 정수로 @ (10)를 통과 할 수처럼

ACAccountStore *accountStore = [[ACAccountStore alloc] init]; 
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; 

[accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) { 
    if (granted) { 
     NSArray *twitterAccounts = [accountStore accountsWithAccountType:accountType]; 

     if (twitterAccounts.count == 0) { 
      NSLog(@"There are no Twitter accounts configured. You can add or create a Twitter account in Settings."); 
     } 
     else { 
      ACAccount *twitterAccount = [twitterAccounts firstObject]; 

      SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/home_timeline.json"] parameters:@{@"count": @10}]; 
      request.account = twitterAccount; 

      [request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { 
       NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; 

       NSLog(@"%@", responseString); 
      }]; 
     } 
    } 
}]; 

답변

0

나에게 보이는 :

여기 내 코드입니다.

SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET 
         URL:[NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/home_timeline.json"] 
         parameters:@{@"count": @"10"}]; 
              //^

는 여기를이었다 Twitter doc with an example

+0

입니다, 감사합니다! 나는 그것을 깨닫지 못했다고 믿을 수 없다. –

+0

: D 사실, 그렇게되기 전에 정확히 그 일이 일어났다. – brandonscript