【发布时间】:2021-10-30 09:11:39
【问题描述】:
该应用在前台运行良好。动画工作,音频播放没有问题(甚至来自通知)。 但是,在应用程序进入后台后,一段时间后,应用程序崩溃并出现以下错误:
Exception Type: EXC_BAD_ACCESS ()
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016b45fff0
VM Region Info: 0x16b45fff0 is in 0x16b45c000-0x16b460000; bytes after start: 16368 bytes before end: 15
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
CoreAnimation 11edd0000-11f860000 [ 10.6M] rw-/rwx SM=PRV
GAP OF 0x4bbfc000 BYTES
---> STACK GUARD 16b45c000-16b460000 [ 16K] ---/rwx SM=NUL ... for thread 0
Stack 16b460000-16b55c000 [ 1008K] rw-/rwx SM=PRV thread 0
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [7134]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libswiftCore.dylib 0x000000018d84f360 swift::MetadataCacheKey::operator==(swift::MetadataCacheKey) const + 4 (MetadataCache.h:457)
1 libswiftCore.dylib 0x000000018d84f5c0 std::__1::pair<swift::HashMapElementWrapper<(anonymous namespace)::GenericCacheEntry>*, unsigned int> swift::ConcurrentReadableHashMap<swift::HashMapElementWrapper<(anonymous namespace)::GenericCac... + 272 (MetadataCache.h:1439)
2 libswiftCore.dylib 0x000000018d841bd8 _swift_getGenericMetadata(swift::MetadataRequest, void const* const*, swift::TargetTypeContextDescriptor<swift::InProcess> const*) + 380 (Concurrent.h:1001)
3 libswiftCore.dylib 0x000000018d822d00 __swift_instantiateCanonicalPrespecializedGenericMetadata + 36 (<compiler-generated>:0)
4 SwiftUI 0x00000001909499a8 AnimatorBox.value(in:for:) + 140 (Animation.swift:167)
5 SwiftUI 0x0000000190948454 AnyAnimator.value(in:for:) + 140 (Animation.swift:116)
6 SwiftUI 0x00000001907d548c DefaultCombiningAnimator.value(in:for:) + 716 (DefaultCombiningAnimation.swift:26)
我个人认为这与音频的关系比任何动画都多,但是,错误堆栈并没有真正的帮助。另一个问题是,我不能说应用程序是否已经在后台崩溃,或者只是在显示屏亮起时,应用程序准备返回前台。
有人遇到过这个错误吗?是什么原因造成的? Animation.swift 是一个系统文件,我无法将问题追溯到我的代码。
欢迎提出任何建议。谢谢。
【问题讨论】:
标签: swift xcode animation audio swiftui