I'm getting a lot of these crash reports:
Fatal Exception: AmazonClientException
Request timed out.
Thread : Fatal Exception: AmazonClientException
0 CoreFoundation 0x2e2cdf83 __exceptionPreprocess + 130
1 libobjc.A.dylib 0x38a7eccf objc_exception_throw + 38
2 MyApp 0x002b8605 +[AmazonErrorHandler errorFromException:serviceErrorDomain:clientErrorDomain:]
3 MyApp 0x0024af5d -[AmazonS3Client invoke:] (AmazonS3Client.m:549)
4 MyApp 0x00249721 -[AmazonS3Client putObject:] (AmazonS3Client.m:134)
5 MyApp 0x000e9d0b -[MyAppAmazonClient uploadObject:async:contentType:path:bucket:type:username:update:success:failure:] (MyAppAmazonClient.m:199)
6 MyApp 0x000e998f -[MyAppAmazonClient uploadObject:async:contentType:path:type:username:update:success:failure:] (MyAppAmazonClient.m:150)
7 MyApp 0x000e962d -[MyAppAmazonClient tryUploadObject:async:contentType:path:type:username:update:success:failure:] (MyApp AmazonClient.m:121)
8 MyApp 0x001ee233 -[SomeOperation uploadFile:] (SomeOperation.m:148)
9 MyApp 0x001edf6b -[SomeOperation performServerUploadFiles] (SomeOperation.m:127)
10 MyApp 0x001ed22f -[SomeOperation main] (SomeOperation.m:50)
11 Foundation 0x2ec025ab -[__NSOperationInternal _start:] + 770
12 Foundation 0x2eca676d __NSOQSchedule_f + 60
13 libdispatch.dylib 0x38f689ab _dispatch_async_redirect_invoke$VARIANT$up + 110
14 libdispatch.dylib 0x38f79921 _dispatch_root_queue_drain + 224
15 libdispatch.dylib 0x38f79b21 _dispatch_worker_thread2 + 56
16 libsystem_pthread.dylib 0x390a8bd3 _pthread_wqthread + 298
17 libsystem_pthread.dylib 0x390a8a98 start_wqthread + 8
The line of code where the error occurs is this:
S3PutObjectResponse *response = [self.s3 putObject:putObjectRequest]; //ERROR HERE
if(response.error != nil)
{
NSLog(@"Amazon Client Error: %@", response.error);
}
if (response.exception) {
if (theRequest.failureBlock) {
theRequest.failureBlock([response description]);
}
}
else if (scRequest.successBlock) {
//success
}
The problem is that the time out occurs and therefore I don't get a chance to handle any errors or exceptions.
Where can I put code to handle the request time out so that the app doesn't crash?
The crash only occurs when the request times out.
The AmazonS3Client method you're calling is throwing an Objective-C exception. Catch it using @try
/ @catch
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.