[英]EXC_BAD_INSTRUCTION from com.apple.xpc.activity.com.apple.cloudkit.scheduler.com.apple.coredata.cloudkit.activity.export
I have an app that runs fine on iOS, but when running with catalyst, it gives me this crash intermittently if I swipe to another virtual Desktop on macOS, and then back, for about 10 times.我有一个在 iOS 上运行良好的应用程序,但是当使用催化剂运行时,如果我在 macOS 上滑动到另一个虚拟桌面,然后再返回大约 10 次,它会间歇性地崩溃。 It mostly happens on a UICollectionViewController它主要发生在 UICollectionViewController
This is the backtrace:这是回溯:
(lldb) bt
* thread #5, queue = 'com.apple.xpc.activity.com.apple.cloudkit.scheduler.com.apple.coredata.cloudkit.activity.export', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
* frame #0: 0x00007fff68c373ae libxpc.dylib`___xpc_activity_dispatch_block_invoke.107.cold.3 + 19
frame #1: 0x00007fff68c1ecdb libxpc.dylib`___xpc_activity_dispatch_block_invoke.107 + 746
frame #2: 0x00000001010377b3 libdispatch.dylib`_dispatch_call_block_and_release + 12
frame #3: 0x000000010103878f libdispatch.dylib`_dispatch_client_callout + 8
frame #4: 0x000000010103fd31 libdispatch.dylib`_dispatch_lane_serial_drain + 777
frame #5: 0x0000000101040ae8 libdispatch.dylib`_dispatch_lane_invoke + 438
frame #6: 0x000000010104df2e libdispatch.dylib`_dispatch_workloop_worker_thread + 681
frame #7: 0x00000001010c4053 libsystem_pthread.dylib`_pthread_wqthread + 290
frame #8: 0x00000001010c3eb3 libsystem_pthread.dylib`start_wqthread + 15
(lldb)
I have tried reviewing the codes, adding print statements, adding breakpoints, commenting out certain parts etc, trying to figure out which part of my code causes this, but failed so far.我尝试过查看代码、添加打印语句、添加断点、注释掉某些部分等,试图找出我的代码的哪一部分导致了这种情况,但到目前为止失败了。
I am using NSPersistentCloudKitContainer from iOS 13. Does the stack trace points to a bug inside there?我正在使用 iOS 13 中的 NSPersistentCloudKitContainer。堆栈跟踪是否指向那里的错误?
I've wasted so much time trying to understand the source of the problem and hope that this answer helps many others.我浪费了很多时间试图了解问题的根源,并希望这个答案能帮助许多其他人。
This problems seems to persist now since a long time and has not been fixed, nor understood.这个问题似乎已经存在很长时间了,并且没有得到解决,也没有被理解。 But the big hint I've read in the comments: This crash happens only when the app is run from within Xcode.但我在评论中读到的重要提示:只有当应用程序从 Xcode 中运行时才会发生这种崩溃。
Another important hint: You can can run your build product directly from Finder without crashing.另一个重要提示:您可以直接从 Finder 运行构建产品而不会崩溃。 Even if it is a "Debug" build.即使它是“调试”版本。
Based on this, I've come to the conclusion that the problem is related to the Debug execution environment and I found the solution: Disable "Debug XPC services used by this application"基于此,我得出的结论是问题与Debug执行环境有关,我找到了解决方案:禁用“Debug XPC services used by this application”
There must be some bug in the debugging code used by this option.此选项使用的调试代码中一定存在一些错误。
You can find this option in your targets scheme.您可以在目标方案中找到此选项。
I hope this helps everybody!我希望这对大家有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.