0

I'm having trouble in posting a reply to a specific status ID

Here's my authentication code

twitterWithReply = [STTwitterAPI twitterAPIOSWithFirstAccount];

[twitterWithReply verifyCredentialsWithSuccessBlock:^(NSString *username) {

       NSLog(@"Login Successful");
       self.replyTextField.enabled = YES;

}


errorBlock:^(NSError *error){

       UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Sorry"
                                  message:@"You can't send a tweet right now, make sure your device has an internet connection and you have at least one Twitter account setup"
                                  delegate:self
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
       [alertView show];
    }];

And here's my code for posting the reply

NSLog(@"the text content%@",self.replyTextField.text);
    [self.replyTextField resignFirstResponder];
    if (self.replyTextField.text.length>0 && self.replyTextField.text.length <=140) {
        // Post reply
        [twitterWithReply postStatusUpdate:self.replyTextField.text inReplyToStatusID:self.tweeetID latitude:nil longitude:nil placeID:nil displayCoordinates:nil trimUser:nil successBlock:^(NSDictionary *status) {
            [self showSuccessDialog];
        } errorBlock:^(NSError *error) {
            NSLog(@"%@",[error localizedDescription]);
        }];

    }

Currently what it does is to post to my own timeline not in reply to a specific tweet. I'm under the impression that my authentication code is wrong. So how do I authenticate then?

  • Do you get an error? If so, what does it say? Also, try to log the tweetID and ensure it's correct. – nst Apr 22 '14 at 08:43
  • I'm not getting an error. It just posts into my own timeline not in reply to a specific tweet. I checked the tweetID and I think it's correct, I used the id_str parameter from the statuses got from [twitter getUserTimelineWithScreenName:twitterName successBlock:^(NSArray *statuses) – Romelio Tavas Jr. Apr 23 '14 at 02:24

1 Answers1

1

I just checked this scenario with the development version of STTwitter and it works as expected.

If this code doesn't work for you, then please fill an issue with as much details as possible.

self.twitter = [STTwitterAPI twitterAPIOSWithFirstAccount];

[_twitter verifyCredentialsWithSuccessBlock:^(NSString *username) {

    [_twitter postStatusUpdate:@"test1" inReplyToStatusID:nil latitude:nil longitude:nil placeID:nil displayCoordinates:nil trimUser:nil successBlock:^(NSDictionary *status) {

        NSLog(@"-- status1: %@", status);

        [_twitter postStatusUpdate:@"test2" inReplyToStatusID:[status valueForKey:@"id_str"] latitude:nil longitude:nil placeID:nil displayCoordinates:nil trimUser:nil successBlock:^(NSDictionary *status) {
            NSLog(@"-- status2: %@", status);
        } errorBlock:^(NSError *error) {
            NSLog(@"-- error2: %@", error);
        }];

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

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

enter image description here

nst
  • 3,862
  • 1
  • 31
  • 40
  • i am using STTwitterAPI in iOS to give reply to the tweet from other account, i can reply to the tweet from same account from i am unable to give reply from other account. can you please help me out how to do this. – Anjaneyulu Battula Oct 21 '14 at 17:25