title: iOS: get Twitter feed of public account
body: <p>I need to get a Twitter feed of a public account.  I am able to get my own Twitter feed using the following code: </p>
  
  <pre><code>-(void) testTwitter {
  {
      ACAccountStore *accountStore = [[ACAccountStore alloc]init];
  
      if (accountStore != nil)
      {
          ACAccountType *accountType = [accountStore     accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
          if (accountType != nil)
          {
              [accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error)
               {
                   if (granted)
                   {
  
                       //Succesful Access
                       NSArray *twitterAccounts = [accountStore accountsWithAccountType:accountType];
                       if (twitterAccounts != nil)
                       {
                           ACAccount *currentAccount = [twitterAccounts objectAtIndex:0];
                           if (currentAccount != nil)
                           {
                               NSString *paraString = [NSString stringWithFormat:@"qlx_corp"];
                               NSDictionary *parameters = [NSDictionary dictionaryWithObject:paraString forKey:@"username"];
  
                               NSString *requestString = @"https://api.twitter.com/1.1/statuses/user_timeline.json";
                               SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:requestString] parameters:parameters];
                               [request setAccount:currentAccount];
  
                               [request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
                                {
                                    if ((error == nil) &amp;&amp; ([urlResponse statusCode] == 200))
                                    {
                                        NSArray *twitterFeed = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil];
                                        NSDictionary *firstPost = [twitterFeed objectAtIndex:0];
  
                                        NSLog(@"firstPost = %@", [firstPost description]);
                                    }
                                    else {
                                        NSLog(@"error: %@",error);
                                    }
                                }];
                           }
                       }
                   }
                   else
                   {
                       //Access Denied
                       NSLog(@"access denied");
                   }
               }];
          }
      }
  
  }
  }
  </code></pre>
  
  <p>But when I substitute the following code for getting another account besides my own, I get this error: </p>
  
  <p>code = 215;</p>
  
  <p>message = "Bad Authentication data.";</p>
  
  <p>And this is the code I substituted for a Successful Access (noted in the comments in posted code):</p>
  
  <pre><code>NSURL* url = [NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/user_timeline.json"];
                       NSDictionary* params = @{@"count" : @"10", @"screen_name" : @"qlx_corp"};
  
                       SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter
                                                               requestMethod:SLRequestMethodGET
                                                                         URL:url parameters:params];
  
                       [request performRequestWithHandler:^(NSData *responseData,
                                                            NSHTTPURLResponse *urlResponse, NSError *error) {
  
                           if (!error) {
                               NSError *jsonError;
                           NSArray *responseJSON = [NSJSONSerialization
                                                    JSONObjectWithData:responseData
                                                    options:NSJSONReadingAllowFragments
                                                    error:&amp;jsonError];
                               NSLog(@"response json: %@",responseJSON);
                           // Show the content of the responseJSON in a view.
                       }
                        }];
  </code></pre>
  
  <p>What am I doing wrong that I am getting this error message and not the public twitter feed that I am requesting.  My app asks for permission for Twitter use and it has been granted, so what could be the problem?</p>