"The network connection was lost" when loading a specific Resource

825 Views Asked by At

since a few days I have problems with RestKit 0.20

RestKit is included via CocoaPods so it is up to date. I am developing an app for iOS7 and this problems happen on all real and simulated devices.

When I am loading a resource like an image or a pdf file like this:

RKObjectManager *objectManager = [self.restManager objectManager];
[objectManager setAcceptHeaderWithMIMEType:@"image/jpeg"];
[[objectManager HTTPClient] getPath:path parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
    if (completeBlock) {
        UIImage *image = [UIImage imageWithData:responseObject];
        completeBlock(image);
    }
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    if (failBlock) {
        failBlock(error);
    }
}];

I get this error message:

T restkit.network:RKObjectRequestOperation.m:148 GET 'https://***/attachment/11787':
request.headers={
    Accept = "*";
    "Accept-Language" = "en-US";
    Authorization = "***";
    "User-Agent" = "***";
}
request.body=(null)
E restkit.network:RKObjectRequestOperation.m:174 GET 'https://***/attachment/11787' (200 OK) [1.0048 s]:
error=Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0xf7ba400 {NSErrorFailingURLStringKey=https:/***/attachment/11787, NSErrorFailingURLKey=https://***/attachment/11787, NSLocalizedDescription=The network connection was lost., NSUnderlyingError=0x1605c930 "The network connection was lost."}
response.body=(null)

But this is not the common case for all resources but for only a few. The other resources get loaded at the same time (The requests were added to the queue at the same time).

Once this error happends for a resource, the resource will never get loaded again but failing with the same error message.

I cleaned the cache and deleted the app, so it shouldn't be a problem with caching or something like that. And there is no difference if http or https is used.

Similar to this question (without solution): Restkit not work on iOS 7

Do you have any ideas, what I am doing wrong or what causes this behaviour?

0

There are 0 best solutions below