Hello!
I wrote program for iOS that receives data from a remote Web server through RestKit. Everything is working.
But during testing the program I found one WiFi network, wherein iPad 2 ALWAYS can not obtain the data because of the error: "The request time out"When I run the following code:
AppDelegate *delegate = [[UIApplication sharedApplication]delegate];
AFHTTPClient *client = delegate.objectManager.HTTPClient;
NSMutableURLRequest *request = [client requestWithMethod:@"GET" path:url parameters:nil];
[request setTimeoutInterval:80];
AFHTTPRequestOperation *operation = [client HTTPRequestOperationWithRequest:request
success:^(AFHTTPRequestOperation *operation, id responseObject) {
@try {
NSString *msg = operation.responseString;
if ([msg length]>100)
NSLog(@"Response %@", [msg substringToIndex:100]);
else
NSLog(@"Response %@", msg);
[self parseJSONResponse:msg fromString:from trimLen:trim withFormat:format target:self action:action];
}
@catch (NSException *exception) {
// Ошибка
NSString *msg = [NSString stringWithFormat:@"Ошибка: %@", exception.description];
[self onError:msg];
}
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
// Ошибка
NSString *msg = [NSString stringWithFormat:@"Ошибка: %@", error.localizedDescription];
[self onError:msg];
}];
[client enqueueHTTPRequestOperation:operation];
I have the following error occurs:
2015-11-28 14:33:56.210 TelexReader[1261:124823] I restkit.network:RKObjectRequestOperation.m:222 GET 'https://tlxmob.1tv.ru/authorize.php' (200 OK / 0 objects) [request=0.4474s mapping=0.0360s total=0.7016s]
2015-11-28 14:33:56.211 TelexReader[1261:124747] Login success
2015-11-28 14:35:55.328 TelexReader[1261:124747] I restkit.network:RKObjectRequestOperation.m:150 GET 'https://tlxmob.1tv.ru/messages.get'
2015-11-28 14:36:11.714 TelexReader[1261:124747] E restkit.network:RKObjectRequestOperation.m:180 GET 'https://tlxmob.1tv.ru/messages.get' (0) [16.3854 s]: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=https://tlxmob.1tv.ru/messages.get, _kCFStreamErrorCodeKey=60, NSErrorFailingURLKey=https://tlxmob.1tv.ru/messages.get, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=1, NSUnderlyingError=0x14574940 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=60, NSErrorFailingURLStringKey=https://tlxmob.1tv.ru/messages.get, NSErrorFailingURLKey=https://tlxmob.1tv.ru/messages.get, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=1}}}
Please, нelp me find the error.
Alexander.
P.S. On remote remote Web server I use Apache Authorization.