我正在开发 UI 扩展,它可以在 iOS 15 上正常工作,但在运行 iOS 14 的设备上启动时崩溃。据我了解,所提供的日志意味着崩溃发生在执行扩展的代码之前,因此我无法修复自己编写代码来解决问题(但我不是专业的 iOS 开发人员,所以......)。
部分崩溃日志:
Incident Identifier: 90720807-BB29-40B0-99EA-FCF7D9347CB4
CrashReporter Key: 318d9685fef2ea9c117d9f313ee2a7abc8de6187
Hardware Model: iPhone12,1
Process: OWExtension [2853]
Path: /private/var/containers/Bundle/Application/946320B4-00EB-4DFA-9D83-498BF85B6E89/App.app/PlugIns/OWExtension.appex/OWExtension
Identifier: com.example.ow.OWExtension
Version: 10 (9.99)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.example.ow.OWExtension [4266]
Date/Time: 2022-01-12 15:51:59.1501 +0300
Launch Time: 2022-01-12 15:50:16.3811 +0300
OS Version: iPhone OS 14.6 (18F72)
Release Type: User
Baseband Version: 2.05.01
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000af7aec290
VM Region Info: 0xaf7aec290 is not in any region. Bytes after previous region: 35830809233 Bytes before following region: 20540636528
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
MALLOC_NANO 280000000-2a0000000 [512.0M] rw-/rwx SM=COW
---> GAP OF 0xd20000000 BYTES
commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=NUL ...(unallocated)
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [2853]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001982c2c80 objc_retain + 16
1 UIKitCore 0x0000000185de7634 _UISetCurrentFallbackEnvironment + 72
2 UIKitCore 0x00000001866066c8 -[_UIViewServiceViewControllerOperator __createViewControllerWithOptions:completionBlock:] + 588
3 CoreFoundation 0x0000000183803774 __invoking___ + 148
4 CoreFoundation 0x00000001836d6d44 -[NSInvocation invoke] + 380
5 CoreFoundation 0x00000001836d7348 -[NSInvocation invokeWithTarget:] + 80
6 UIKitCore 0x0000000186611170 -[_UIViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 108
7 CoreFoundation 0x0000000183800fe8 ___forwarding___ + 736
8 CoreFoundation 0x00000001838035b0 _CF_forwarding_prep_0 + 96
9 CoreFoundation 0x0000000183803774 __invoking___ + 148
10 CoreFoundation 0x00000001836d6d44 -[NSInvocation invoke] + 380
11 CoreFoundation 0x00000001836d7348 -[NSInvocation invokeWithTarget:] + 80
12 UIKitCore 0x00000001865f7464 -[_UIQueueingProxy forwardInvocation:] + 376
13 CoreFoundation 0x0000000183800fe8 ___forwarding___ + 736
14 CoreFoundation 0x00000001838035b0 _CF_forwarding_prep_0 + 96
15 CoreFoundation 0x0000000183803774 __invoking___ + 148
16 CoreFoundation 0x00000001836d6d44 -[NSInvocation invoke] + 380
17 CoreFoundation 0x00000001836d7348 -[NSInvocation invokeWithTarget:] + 80
18 CoreFoundation 0x0000000183800fe8 ___forwarding___ + 736
19 CoreFoundation 0x00000001838035b0 _CF_forwarding_prep_0 + 96
20 CoreFoundation 0x0000000183803774 __invoking___ + 148
21 CoreFoundation 0x00000001836d6d44 -[NSInvocation invoke] + 380
22 libdispatch.dylib 0x00000001833eb81c _dispatch_client_callout + 20
23 libdispatch.dylib 0x00000001833ef30c _dispatch_block_invoke_direct + 268
24 FrontBoardServices 0x0000000192de3fa0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48
25 FrontBoardServices 0x0000000192de3c30 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 448
26 FrontBoardServices 0x0000000192de4184 -[FBSSerialQueue _performNextFromRunLoopSource] + 32
27 CoreFoundation 0x00000001837789e8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
28 CoreFoundation 0x00000001837788e4 __CFRunLoopDoSource0 + 208
29 CoreFoundation 0x0000000183777be8 __CFRunLoopDoSources0 + 268
30 CoreFoundation 0x0000000183771bc8 __CFRunLoopRun + 820
31 CoreFoundation 0x0000000183771360 CFRunLoopRunSpecific + 600
32 GraphicsServices 0x000000019adaf734 GSEventRunModal + 164
33 UIKitCore 0x00000001861ec584 -[UIApplication _run] + 1072
34 UIKitCore 0x00000001861f1df4 UIApplicationMain + 168
35 libxpc.dylib 0x00000001cf391ba4 _xpc_objc_main + 600
36 libxpc.dylib 0x00000001cf393f1c xpc_main + 180
37 Foundation 0x0000000184a94a18 +[NSXPCListener serviceListener] + 0
38 PlugInKit 0x00000001b420f71c 0x1b41f5000 + 108316
39 PlugInKit 0x00000001b420f344 0x1b41f5000 + 107332
40 PlugInKit 0x00000001b420fb34 0x1b41f5000 + 109364
41 ExtensionKit 0x0000000187ce5fe8 EXExtensionMain + 84
42 Foundation 0x0000000184be370c NSExtensionMain + 200
43 libdyld.dylib 0x000000018342dcf8 start + 4
Thread 1:
0 libsystem_pthread.dylib 0x00000001cf369744 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x00000001cf369744 start_wqthread + 0
Thread 3 name: com.apple.uikit.eventfetch-thread
Thread 3:
0 libsystem_kernel.dylib 0x00000001b18f04fc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b18ef884 mach_msg + 76
2 CoreFoundation 0x0000000183777eb0 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x0000000183771d50 __CFRunLoopRun + 1212
4 CoreFoundation 0x0000000183771360 CFRunLoopRunSpecific + 600
5 Foundation 0x0000000184a5efdc -[NSRunLoop+ 32732 (NSRunLoop) runMode:beforeDate:] + 232
6 Foundation 0x0000000184a5eea8 -[NSRunLoop+ 32424 (NSRunLoop) runUntilDate:] + 92
7 UIKitCore 0x00000001862a112c -[UIEventFetcher threadMain] + 516
8 Foundation 0x0000000184bd032c __NSThread__start__ + 864
9 libsystem_pthread.dylib 0x00000001cf360bfc _pthread_start + 320
10 libsystem_pthread.dylib 0x00000001cf369758 thread_start + 8
Thread 4:
0 libsystem_pthread.dylib 0x00000001cf369744 start_wqthread + 0
Thread 5:
0 libsystem_pthread.dylib 0x00000001cf369744 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x000000028313c270 x1: 0x00000001d2e24964 x2: 0x0000000000000000 x3: 0x00000001026e454c
x4: 0x000000000000001c x5: 0x000000010288f9a0 x6: 0x0000000000000000 x7: 0x000000000000003e
x8: 0x0000368af7aec270 x9: 0x0000000af7aec270 x10: 0x02000001e5d82d39 x11: 0x03000001e5d82d39
x12: 0x0000000000524980 x13: 0x00000001e5d24f80 x14: 0x0002000110000550 x15: 0x00000001e5d24f80
x16: 0x00000001982c2c70 x17: 0x00000001833eacac x18: 0x0000000000000000 x19: 0x0000000283130000
x20: 0xb5783ab44021d400 x21: 0x0000000109009400 x22: 0x00000001e64656a8 x23: 0x0000000280a280c0
x24: 0x0000000283130000 x25: 0x0000000282e34300 x26: 0x0000000000000000 x27: 0x00000001d2cb7ae4
x28: 0x00000002829281e0 fp: 0x000000016d9917a0 lr: 0x0000000185de7634
sp: 0x000000016d991750 pc: 0x00000001982c2c80 cpsr: 0x20000000
esr: 0x92000006 (Data Abort) byte read Translation fault
在另一个调试会话期间使用 Zombie 对象,我能够收到以下消息(我删除了实际地址,因为它不属于所呈现的日志)
[UITraitCollection retain]: message sent to deallocated instance 0x...
也许有人可以解释一下这里发生的事情?
对于那些面临此问题的用户,我们联系了 Apple,并收到确认,该 UI 扩展在 iOS 14 上无法正常运行。要使用该扩展,必须在 iOS 15 或更高版本上提供该扩展。看来他们的文档在这个问题上可能会产生误导。