0

i am used STTweeter for posting Tweets but it showing EXC_BAD_ACESS Error and showing error STTwitterTwitter ErrorDomain code 220

enter image description here My code

    - (void)setOAuthToken:(NSString *)token oauthVerifier:(NSString *)verifier {

  // in case the user has just authenticated through WebViewVC
  [self dismissViewControllerAnimated:YES
                           completion:^{//
                           }];

  [_twitter postAccessTokenRequestWithPIN:verifier
      successBlock:^(NSString *oauthToken, NSString *oauthTokenSecret,
                     NSString *userID, NSString *screenName) {
          NSLog(@"-- screenName: %@", screenName);

          self.twitter = [STTwitterAPI
              twitterAPIAppOnlyWithConsumerKey:_consumerKeyTextField.text
                                consumerSecret:_consumerSecretTextField.text];

          [_twitter verifyCredentialsWithSuccessBlock:^(NSString *username) {

              [_twitter postStatusUpdate:@"tweet text"
                       inReplyToStatusID:nil
                                latitude:nil
                               longitude:nil
                                 placeID:nil
                      displayCoordinates:nil
                                trimUser:nil
                            successBlock:nil
                              errorBlock:nil];
              NSLog(@"Sucess");

          } errorBlock:^(NSError *error) {
              NSLog(@"_____ERROR____%@", error);
          }];

          _loginStatusLabel.text = screenName;

      }
      errorBlock:^(NSError *error) {

          _loginStatusLabel.text = [error localizedDescription];
          NSLog(@"-- %@", [error localizedDescription]);
      }];
}
Kirit Modi
  • 23,155
  • 15
  • 89
  • 112
RameshIos
  • 301
  • 1
  • 4
  • 13
  • At which point does the code behaving as you expect? Can you post the logs? – nst Mar 17 '15 at 21:39
  • I get the EXC_BAD_ACCESS Error....and error showing STTwitterErrorDomain code:220 Your Credentials do not allow to this resource.STHTTPRequest-code:403 – RameshIos Mar 18 '15 at 05:44
  • You cannot post if you haven't authenticated a user. Also, you shouldn't re-instantiate STTwitterAPI in the successBlock. See the STTwitterDemoiOS and STTwitterDemoOSX for working examples. – nst Mar 18 '15 at 11:57
  • you haven't authenticated a user. means how to get authenticate my user ?and in successBlock i put like this successBlock:^(NSDictionary *status) { NSLog(@"===1===Sucess"); }errorBlock:^(NSError *error) { NSLog(@"_____ERROR ===1==%@",error);}]; even though getting STTwitterErrorDomain code:220 – RameshIos Mar 18 '15 at 12:46

0 Answers0