首页 > 解决方案 > Flutter 崩溃 iOS - NSInvalidArgumentException

问题描述

有谁知道这个崩溃是什么?我在网上查了一下,有些结果似乎相似但不完全相同。以下是 Crashlytics 中的痕迹:

致命异常:NSInvalidArgumentException -[__NSCFString substringWithRange:]: Range {19, 9223372036854775788} 越界;字符串长度 0

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x1b3d19344 __exceptionPreprocess
1  libobjc.A.dylib                0x1b3a2ecc0 objc_exception_throw
2  CoreFoundation                 0x1b3d72550 -[__NSCFString characterAtIndex:].cold.1
3  CoreFoundation                 0x1b3d72650 -[__NSCFString hasPrefix:].cold.1
4  CoreFoundation                 0x1b3bf7c0c -[_CFXNotificationNameRegistration find:observer:matching:]
5  UIKitCore                      0x1b7cfece8 -[UIResponder(UITextInput_Internal) _rangeOfText:endingAtPosition:]
6  UIKitCore                      0x1b7c68ab0 -[UIKeyboardImpl applyAutocorrection:]
7  UIKitCore                      0x1b7c5c9c0 -[UIKeyboardImpl acceptAutocorrection:executionContextPassingTIKeyboardCandidate:]
8  UIKitCore                      0x1b7c5bd58 -[UIKeyboardImpl acceptAutocorrectionForWordTerminator:executionContextPassingTIKeyboardCandidate:]
9  UIKitCore                      0x1b7c5bc10 __56-[UIKeyboardImpl acceptAutocorrectionForWordTerminator:]_block_invoke
10 UIKitCore                      0x1b7c84188 -[UIKeyboardTaskEntry execute:]
11 UIKitCore                      0x1b7c82af0 -[UIKeyboardTaskQueue continueExecutionOnMainThread]
12 UIKitCore                      0x1b7c8317c -[UIKeyboardTaskQueue addAndReturnTask:]
13 UIKitCore                      0x1b7c8366c -[UIKeyboardTaskQueue performSingleTask:]
14 UIKitCore                      0x1b7c5bb1c -[UIKeyboardImpl acceptAutocorrectionForWordTerminator:]
15 UIKitCore                      0x1b7c5eddc -[UIKeyboardImpl acceptAutocorrection]
16 UIKitCore                      0x1b7c43bf0 -[UIKeyboardImpl setDelegate:force:]
17 UIKitCore                      0x1b791bfa0 -[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:]
18 UIKitCore                      0x1b791b7b8 -[UIInputResponderController _reloadInputViewsForResponder:]
19 UIKitCore                      0x1b7e7037c -[UIResponder _finishResignFirstResponder]
20 UIKitCore                      0x1b7e70470 -[UIResponder resignFirstResponder]
21 UIKitCore                      0x1b82fb058 -[UIView(Hierarchy) _removeFirstResponderFromSubtree]
22 UIKitCore                      0x1b82fb564 __UIViewWillBeRemovedFromSuperview
23 UIKitCore                      0x1b82fb3ac -[UIView(Hierarchy) removeFromSuperview]
24 Flutter                        0x100555898 (Missing)
25 Flutter                        0x1005550cc (Missing)
26 Flutter                        0x100554e40 (Missing)
27 Flutter                        0x100a97e20 (Missing)
28 Flutter                        0x1005675bc (Missing)
29 Flutter                        0x10083a108 (Missing)
30 Flutter                        0x100570af4 (Missing)
31 Flutter                        0x1005727b0 (Missing)
32 CoreFoundation                 0x1b3c953a8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
33 CoreFoundation                 0x1b3c950c0 __CFRunLoopDoTimer
34 CoreFoundation                 0x1b3c94740 __CFRunLoopDoTimers
35 CoreFoundation                 0x1b3c8f538 __CFRunLoopRun
36 CoreFoundation                 0x1b3c8ebc8 CFRunLoopRunSpecific
37 GraphicsServices               0x1be0705cc GSEventRunModal
38 UIKitCore                      0x1b7e41744 UIApplicationMain
39 Runner                         0x1000c9804 main + 6 (AppDelegate.swift:6)
40 libdyld.dylib                  0x1b3b0b384 start

和崩溃:com.twitter.crashlytics.ios.exception SIGABRT ABORT 0x00000001b3b00df0

Crashed: com.twitter.crashlytics.ios.exception
0  Runner                         0x1000e2fec CLSProcessRecordAllThreads + 4303040492
1  Runner                         0x1000e33d4 CLSProcessRecordAllThreads + 4303041492
2  Runner                         0x1000d2c4c CLSHandler + 4302974028
3  Runner                         0x1000e15f0 __CLSExceptionRecord_block_invoke + 4303033840
4  libdispatch.dylib              0x1b39bb5ac _dispatch_client_callout + 20
5  libdispatch.dylib              0x1b39c8360 _dispatch_lane_barrier_sync_invoke_and_complete + 60
6  Runner                         0x1000e105c CLSExceptionRecord + 4303032412
7  Runner                         0x1000e0e88 CLSExceptionRecordNSException + 4303031944
8  Runner                         0x1000e0a7c CLSTerminateHandler() + 4303030908
9  libc++abi.dylib                0x1b3ad340c std::__terminate(void (*)()) + 20
10 libc++abi.dylib                0x1b3ad6160 __cxa_rethrow + 148
11 libobjc.A.dylib                0x1b3a2ee84 objc_exception_rethrow + 44
12 CoreFoundation                 0x1b3c8ec38 CFRunLoopRunSpecific + 592
13 GraphicsServices               0x1be0705cc GSEventRunModal + 164
14 UIKitCore                      0x1b7e41744 UIApplicationMain + 1936
15 Runner                         0x1000c9804 main + 6 (AppDelegate.swift:6)
16 libdyld.dylib                  0x1b3b0b384 start + 4

这似乎与 EditText 有关(此崩溃发生在我的登录屏幕上),但我不知道是什么。只有 1 台设备受到影响 - 13.6.1 上的 XS Max。没有其他 XS Max 设备或 13.6.1 上的其他设备受到影响,仅此一个,可能是由于设备配置或其他原因?任何想法都会有所帮助。

附带说明一下,有没有办法从 Crashlytics 获取更多可读日志?就像可能得到 Flutter 会在 Debug 应用程序上抛出的确切错误?我没有使用 Swift 的经验,所以来自 iOS 的日志对我来说毫无意义。谢谢!

标签: iosswiftfluttercrashcrashlytics

解决方案


推荐阅读