繁体   English   中英

iOS Amazon S3客户端-如何处理“请求超时”

[英]iOS Amazon S3 Client - how to handle “Request timed out”

我收到很多这些崩溃报告:

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

发生错误的代码行是这样的:

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
        }

问题是发生超时,因此我没有机会处理任何错误或异常。

我在哪里可以放置代码来处理请求超时,以使应用程序不会崩溃?

仅当请求超时时才发生崩溃。

您正在调用的AmazonS3Client方法抛出一个Objective-C异常。 使用@try / @catch捕获它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM