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?