我正在使用 Sentry 在我的应用程序中记录错误。一般功能可以正常工作,但是它在堆栈跟踪中不包含数字行,因此很难识别问题的根源。通常它会显示方法名称,但如果它是来自另一个线程中 Alamofire 请求的一些响应,它会变得更加困难。示例事件:
OS Version: iOS 14.1 (19H114)
Report Version: 104
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: ILL_NOOP at 0x000000010b1edc34
Crashed Thread: 0
Application Specific Information:
Fatal error > <appName>/IssuesViewController+Sync.swift > Unexpectedly found nil while unwrapping an Optional value
Thread 0 Crashed:
0 libswiftCore.dylib 0x10b1edc34 _assertionFailure
1 libswiftCore.dylib 0x10b1ed786 _assertionFailure
2 libswiftCore.dylib 0x10b1ed462 _assertionFailure
3 libswiftCore.dylib 0x10b1ed0e0 _assertionFailure
4 <appName> 0x20976243e IssuesViewController.manualSync
5 <appName> 0x2097622a3 IssuesViewController.didGetAccounts
6 <appName> 0x2095e2223 FMDBManager.saveAllAccounts
7 <appName> 0x209761e3f IssuesViewController.didGetAccounts
8 <appName> 0x209581038 RequestService.getAllAccounts
9 Alamofire 0x10a74bd61 DataRequest.response<T>
10 Alamofire 0x10a705830 @callee_guaranteed
11 libdispatch.dylib 0xfffe4020835a _dispatch_call_block_and_release
12 libdispatch.dylib 0xfffe40209533 _dispatch_client_callout
13 libdispatch.dylib 0xfffe40216010 _dispatch_main_queue_callback_4CF
14 CoreFoundation 0xfffe406d1275 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
15 CoreFoundation 0xfffe406cbb05 __CFRunLoopRun
16 CoreFoundation 0xfffe406cab9d CFRunLoopRunSpecific
17 GraphicsServices 0xfffe56f23db2 GSEventRunModal
18 UIKitCore 0xfffe480f040e -[UIApplication _run]
19 UIKitCore 0xfffe480f531f UIApplicationMain
20 <appName> 0x20985d2eb main
21 libdyld.dylib 0xfffe404ad408 start
当前配置:
SentrySDK.start(options: [
"dsn": dsn,
"environment": environment,
"debug": false
])
我也试过添加
"attach-stacktrace": true
到选项,但它默认启用,所以这里没有区别。
错误捕获(实际上启用了调试选项,它会在包含数字行的控制台中打印):
SentrySDK.capture(error: error) // as NSError
目前使用 Sentry-Cocoa 版本 7.0.0。我是否应该以其他方式配置我的 SentrySDK 配置来处理行号?