我知道这个崩溃与后台更新复杂性有关,系统自动释放对象可能是由于挂起状态。所以这里详细介绍了我在 watchOS 应用程序中尝试做的事情。
我正在后台更新并发症内容。此更新的详细信息是从服务器接收的。所以我应该启用任何后台模式吗?
提供背景模式音频、位置、远程通知和锻炼
但上述模式不符合我的要求,因为没有使用上述任何服务,只是从服务器更新复杂数据。
我使用 scheduleBackgroundRefresh 每 15 分钟更新一次并发症。
这是崩溃日志
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x2054c564 __abort_with_payload + 8
1 libsystem_kernel.dylib 0x20550d24 abort_with_payload_wrapper_internal + 100 (terminate_with_reason.c:102)
2 libsystem_kernel.dylib 0x20550cc0 abort_with_reason + 28 (terminate_with_reason.c:116)
3 WatchKit 0x332b916c -[WKRefreshBackgroundTask dealloc] + 536 (SPUtils.h:15)
4 watchkitapp Extension 0x02f75710 outlined consume of Set<A>.Iterator._Variant<A> + 36
5 libswiftCore.dylib 0x472552b8 _swift_release_dealloc + 28 (HeapObject.cpp:626)
6 watchkitapp Extension 0x02f757a0 partial apply for closure #1 in ExtensionDelegate.updateContentInBackgorund(_:) + 448416 (ExtensionDelegate.swift:74)
7 libswiftCore.dylib 0x472552b8 _swift_release_dealloc + 28 (HeapObject.cpp:626)
8 watchkitapp Extension 0x02f757a0 partial apply for closure #1 in ExtensionDelegate.updateContentInBackgorund(_:) + 448416 (ExtensionDelegate.swift:74)
9 watchkitapp Extension 0x02f75808 partial apply for thunk for @escaping @callee_guaranteed (@unowned Bool, @unowned Int?, @guaranteed DomainHome?, @guaranteed [String : Any]?, @guaranteed Error?) -> () + 448520 (<compiler-generated>:0)
10 libswiftCore.dylib 0x472552b8 _swift_release_dealloc + 28 (HeapObject.cpp:626)
11 watchkitapp Extension 0x02f757a0 partial apply for closure #1 in ExtensionDelegate.updateContentInBackgorund(_:) + 448416 (ExtensionDelegate.swift:74)
12 watchkitapp Extension 0x02f7581c partial apply for thunk for @escaping @callee_guaranteed (@unowned Bool, @unowned Int?, @guaranteed DomainHome?, @guaranteed [String : Any]?, @guaranteed Error?) -> () + 448540 (<compiler-generated>:0)
13 libswiftCore.dylib 0x472552b8 _swift_release_dealloc + 28 (HeapObject.cpp:626)
14 watchkitapp Extension 0x02f60c24 partial apply for specialized closure #1 in RequestManager.performRequestWithURL<A>(_:method:payload:useAuthentication:credentials:handler:) + 363556 (<compiler-generated>:0)
15 watchkitapp Extension 0x02f61b24 block_destroy_helper.85 + 16
16 libswiftCore.dylib 0x472552b8 _swift_release_dealloc + 28 (HeapObject.cpp:626)
17 libsystem_blocks.dylib 0x2042ea5c _Block_release + 140 (runtime.cpp:177)
18 libdispatch.dylib 0x20394fc0 _dispatch_client_callout + 16 (object.m:495)
19 libdispatch.dylib 0x203a0e7c _dispatch_main_queue_callback_4CF + 924 (inline_internal.h:2484)
20 CoreFoundation 0x2093ddcc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1749)
21 CoreFoundation 0x20938df4 __CFRunLoopRun + 1852 (CFRunLoop.c:3069)
22 CoreFoundation 0x209383b0 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
23 GraphicsServices 0x23ed8358 GSEventRunModal + 160 (GSEvent.c:2246)
24 UIKitCore 0x3da4b87c UIApplicationMain + 1756 (UIApplication.m:4820)
25 libxpc.dylib 0x20629bdc _xpc_objc_main.cold.3 + 208
26 libxpc.dylib 0x20615c58 _xpc_objc_main + 212 (main.m:0)
27 libxpc.dylib 0x2061823c xpc_main + 152 (init.c:1384)
28 Foundation 0x213a1738 -[NSXPCListener resume] + 160 (NSXPCListener.m:276)
29 PlugInKit 0x2a30c0a8 -[PKService run] + 396 (PKService.m:165)
30 WatchKit 0x3329fe94 WKExtensionMain + 60 (main.m:19)
31 WatchKit 0x3336d93c main + 12 (main.m:27)
32 libdyld.dylib 0x203d0f48 start + 4