twitter - IOS can't reply status with status_id -


i want reply twitter status status id. http response 403. here code. can sent first tweet. it's id. when want sent reply first tweet it's id http response 403. wrong.

 - (ibaction)btnsendtoucupinside:(id)sender {      __block nsdecimalnumber *tid;     __block int = 0;     while (true) {         if (i == 0  || _birlestirilsinmi) {             urlparametres = [nsdictionary dictionarywithobjectsandkeys: [nsstring stringwithformat:@"%@", [self.twitarray objectatindex:0]], @"status", nil];         }else{             urlparametres = [nsdictionary dictionarywithobjectsandkeys: [nsstring stringwithformat:@"%@", [self.twitarray objectatindex:0]], @"status",[nsstring stringwithformat:@"%@",tid], @"in_reply_to_status_id",@"true", @"include_entities", nil];         }         twrequest *postrequest = [[twrequest alloc] initwithurl:[nsurl urlwithstring:@"https://api.twitter.com/1/statuses/update.json"] parameters:urlparametres requestmethod:twrequestmethodpost];          [postrequest setaccount:[twitaccountarray objectatindex:0]];         [postrequest performrequestwithhandler:^(nsdata *responsedata, nshttpurlresponse *urlresponse, nserror *error)          {              if (responsedata) {                  i++;                  nsdictionary *twdata = [nsjsonserialization jsonobjectwithdata:responsedata options:nsjsonreadingmutableleaves error:&error];                   tid = twdata[@"id"];                  nslog(@"%@",tid);                   //show status after done                  nsstring *output = [nsstring stringwithformat:@"http response status: %i", [urlresponse statuscode]];                  nslog(@"twiter post status : %@", output);              }          }];          if (i == _twitarray.count -1) {             break;         }     } } 

you sending repeatedly same message twitter, loop being erratic , not using twitarray variable. make sure use twitarray when building twrequest instances. need like:

for (nsstring *twit in twitarray) {     ...     urlparametres = @{ @"status" : twit }     ... } 

instead of using [self.twitarray objectatindex:0] @ each iteration...


also take care of twrequest : twrequest deprecated in ios 6.0 - can use instead?


kinda off-topic, while(true) + break bad practice, bad using goto, should use like:

for (nsstring *twit in twitarray) {...} 

or if need reversed order:

for (nsstring *twit in twitarray.reverseobjectenumerator) {...} 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -