0

我在回复特定状态 ID 时遇到问题

这是我的验证码

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

这是我发布回复的代码

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

    }

目前它所做的是发布到我自己的时间线,而不是回复特定的推文。我的印象是我的验证码是错误的。那么我该如何进行身份验证呢?

4

1 回答 1

1

我刚刚用 STTwitter 的开发版本检查了这个场景,它按预期工作。

如果此代码不适合您,请尽可能详细地填写问题。

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

在此处输入图像描述

于 2014-04-23T10:54:55.280 回答