1

I am trying to fetch tweets for a particular account using STTwitter but getting connection timeout error in iOS 9 for verifyCredentialsWithSuccessBlock method. I am getting the tweets properly in iOS 8.4 but having trouble in iOS 9. There is no issue in performing login with twitter using STTWitter. Following is my code:

STTwitterAPI *twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:_consumerKeyTextField
                                                                consumerSecret:_consumerSecretTextField];

[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
 [twitter getUserTimelineWithScreenName:@"Ointeractive"
                     successBlock:^(NSArray *statuses) {

       self.statuses=[NSArray arrayWithArray:statuses];
       Reachability* wifiReach = [Reachability reachabilityForLocalWiFi];

       NetworkStatus netStatus = [wifiReach currentReachabilityStatus];
       if  (netStatus==ReachableViaWiFi) {
            [self updateTwitterLabelAndImage];
            [self addSwipeToTwitterLabel];
       }
    } errorBlock:^(NSError *error) {
      // ...

      NSLog(@"-- %@", [error localizedDescription]);
    }];

 } errorBlock:^(NSError *error) {
 }];

Following is the error that I'm getting:

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x13889ca50 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=https://api.twitter.com/oauth2/token, NSErrorFailingURLKey=https://api.twitter.com/oauth2/token, _kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4, NSLocalizedDescription=The request timed out.}}, NSErrorFailingURLStringKey=https://api.twitter.com/oauth2/token, NSErrorFailingURLKey=https://api.twitter.com/oauth2/token, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}

I tried increasing the timeout interval and also tried disabling the App Transport Security using instructions in this doc but still no luck. Is there any solution to this or will I have to discard STTwitter and switch to twitter integration using fabric?

Ash_B
  • 393
  • 1
  • 3
  • 8
  • 1
    Please ensure you're running the latest STTwitter version available from GitHub by using git pull. Also, please use the verifyCredentialsWithUserSuccessBlock method instead of the deprecated verifyCredentialsWithSuccessBlock. – nst Oct 15 '15 at 15:20
  • 1
    Thanks @nst ... upgrading to the latest version of STTwitter and using the verifyCredentialsWithUserSuccessBlock method solved my issue. Getting the tweets now. Thanks :) – Ash_B Oct 19 '15 at 08:46

0 Answers0