如何在目标c中使用STTwitter发布推文?

时间:2015-03-17 09:19:10

标签: ios objective-c twitter twitter-oauth sttwitter

我使用STTweeter发布推文但显示EXC_BAD_ACESS错误 并显示错误STTwitterTwitter ErrorDomain code 220

enter image description here 我的代码

    - (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]);
      }];
}

0 个答案:

没有答案