gpt4 book ai didi

iOS Amazon S3 客户端 - 如何处理 "Request timed out"

转载 作者:行者123 更新时间:2023-11-29 02:46:52 25 4
gpt4 key购买 nike

我收到了很多这样的崩溃报告:

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 异常。 Catch it using @try / @catch.

关于iOS Amazon S3 客户端 - 如何处理 "Request timed out",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25006228/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com