未捕获 AWSS3TransferManager 默认值S3TransferManager 异常 SIGABRT

AWSS3TransferManager defaultS3TransferManager exception SIGABRT not caught

提问人:es1 提问时间:8/22/2023 更新时间:8/22/2023 访问量:8

问:

当我执行以下代码时,我的 iOS 应用程序崩溃:

    - (UIImage *)getImageAndSaveInDBWithKey:(NSString *)imageKey withKeyPath:(NSString *)keyPath inBucket:(NSString *)bucketName  scanhistoryRecord:(ScanHistory *) scanHistoryRecord
{
  
  [self setImageExceptionTitle:@""];
  [self setImageExceptionName:@""];
  [self setImageExceptionReason:@""];
  
  [self setImageDownloadErrorCode:@""];
  [self setImageDownloadErrorDomain:@""];
  [self setImageDownloadErrorDescription:@""];
  
  NSString *downloadingFilePath = [NSTemporaryDirectory()stringByAppendingPathComponent:imageKey];
  NSURL *downloadingFileURL = [NSURL fileURLWithPath:downloadingFilePath];
  __block UIImage *downloadedImage = nil;
  
  AWSS3TransferManagerDownloadRequest *downloadRequest = [AWSS3TransferManagerDownloadRequest new];
  downloadRequest.bucket = bucketName;
  downloadRequest.key = [NSString stringWithFormat:@"%@%@", keyPath, imageKey];
  downloadRequest.downloadingFileURL = downloadingFileURL;
  
  @try  {
    AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];
    
    [[[transferManager download:downloadRequest] continueWithBlock:^id(AWSTask *task) {
      if (task.error)

在崩溃日志中,我可以看到在以下行中抛出异常:

AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];

这是崩溃日志:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: iTracker [32153]

Triggered by Thread:  6

Last Exception Backtrace:
0   CoreFoundation                  0x1ba17ccb4 __exceptionPreprocess + 164 (NSException.m:202)
1   libobjc.A.dylib                 0x1b32183d0 objc_exception_throw + 60 (objc-exception.mm:356)
2   AWSS3                           0x1036e9b38 __48+[AWSS3TransferManager defaultS3TransferManager]_block_invoke + 440
3   libdispatch.dylib               0x1c1643eac _dispatch_client_callout + 20 (object.m:560)
4   libdispatch.dylib               0x1c16456ec _dispatch_once_callout + 32 (once.c:52)
5   AWSS3                           0x1036e9978 +[AWSS3TransferManager defaultS3TransferManager] + 56
6   iTracker                        0x102a0a79c -[AWSManager getImageAndSaveInDBWithKey:withKeyPath:inBucket:scanhistoryRecord:] + 284 (AWSManager.m:98)
7   iTracker                        0x102a50554 closure #1 in ResultView.showSuccess() + 316 (ResultView.swift:587)
8   iTracker                        0x102a7a63c thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
9   libdispatch.dylib               0x1c1642320 _dispatch_call_block_and_release + 32 (init.c:1518)
10  libdispatch.dylib               0x1c1643eac _dispatch_client_callout + 20 (object.m:560)
11  libdispatch.dylib               0x1c1655a64 _dispatch_root_queue_drain + 684 (queue.c:7051)
12  libdispatch.dylib               0x1c1656158 _dispatch_worker_thread2 + 164 (queue.c:7119)
13  libsystem_pthread.dylib         0x219fadda0 _pthread_wqthread + 228 (pthread.c:2631)
14  libsystem_pthread.dylib         0x219fadb7c start_wqthread + 8

我已将此代码包装在 try catch 块中。但是 catch 块被忽略,应用程序就会崩溃。我能做些什么来解决这个问题?

iOS Objective-C 异常 崩溃 try-catch

评论


答: 暂无答案