Reputation: 834
My iOS App is crashing with the following error:
*** Assertion failure in -[FBSSerialQueue assertOnQueue], /BuildRoot/Library/Caches/com.apple.xbs/Sources/FrontBoardServices/FrontBoard-626.4.1/FrontBoardServices/FBSSerialQueue.m:98
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'
And this is the stacktrace:
Exception: NSInternalInconsistencyException
Reason: threading violation: expected the main thread
Stacktrace: (
0 CoreFoundation 0x000000018d56c980 DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 1255808
1 libobjc.A.dylib 0x000000018d285028 objc_exception_throw + 60
2 CoreFoundation 0x000000018d4694fc DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 193788
3 Foundation 0x000000018d8aa690 7A7A96AF-79E4-3DB1-8904-42E61CAE8999 + 571024
4 FrontBoardServices 0x00000001927ae7ec 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 366572
5 FrontBoardServices 0x0000000192760460 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 46176
6 FrontBoardServices 0x00000001927606ec 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 46828
7 FrontBoardServices 0x00000001927605e4 370F1F18-E8A9-36B5-B0EB-9735A02CE2DE + 46564
8 UIKitCore 0x00000001911e1c40 AAFEFEBE-C172-3346-8972-810EB8F2F2C6 + 5995584
9 UIKitCore 0x00000001912d1870 AAFEFEBE-C172-3346-8972-810EB8F2F2C6 + 6977648
10 UIKitCore 0x00000001912d2640 AAFEFEBE-C172-3346-8972-810EB8F2F2C6 + 6981184
11 CameraUI 0x00000001afbb8514 289C074B-4FFE-3D83-927A-98B268DD914F + 652564
12 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
13 CameraUI 0x00000001afc5b118 289C074B-4FFE-3D83-927A-98B268DD914F + 1319192
14 libobjc.A.dylib 0x000000018d284130 2C18C54E-6C84-310C-851F-F9602890D908 + 20784
15 libobjc.A.dylib 0x000000018d296f80 objc_destructInstance + 92
16 libobjc.A.dylib 0x000000018d29de44 _objc_rootDealloc + 52
17 CameraUI 0x00000001afc502c4 289C074B-4FFE-3D83-927A-98B268DD914F + 1274564
18 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
19 CoreFoundation 0x000000018d4b243c DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 492604
20 CoreFoundation 0x000000018d43cfc0 DC2C95C6-B954-39E8-86A2-5E0AF8801E87 + 12224
21 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
22 CameraUI 0x00000001afcb3704 289C074B-4FFE-3D83-927A-98B268DD914F + 1681156
23 libobjc.A.dylib 0x000000018d284130 2C18C54E-6C84-310C-851F-F9602890D908 + 20784
24 libobjc.A.dylib 0x000000018d296f80 objc_destructInstance + 92
25 libobjc.A.dylib 0x000000018d29de44 _objc_rootDealloc + 52
26 CameraUI 0x00000001afca48ac 289C074B-4FFE-3D83-927A-98B268DD914F + 1620140
27 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
28 libsystem_blocks.dylib 0x000000018d18fa08 _Block_release + 168
29 libobjc.A.dylib 0x000000018d29f3f8 objc_release + 136
30 libsystem_blocks.dylib 0x000000018d18fa08 _Block_release + 168
31 libdispatch.dylib 0x0000000102d3b27c _dispatch_client_callout + 20
32 libdispatch.dylib 0x0000000102d4290c _dispatch_lane_serial_drain + 720
33 libdispatch.dylib 0x0000000102d434fc _dispatch_lane_invoke + 408
34 libdispatch.dylib 0x0000000102d4e4dc _dispatch_workloop_worker_thread + 1344
35 libsystem_pthread.dylib 0x000000018d2776d0 _pthread_wqthread + 280
36 libsystem_pthread.dylib 0x000000018d27d9e8 start_wqthread + 8
)
Is seems to be completely outside of my code. Is there any way to debug this? Is it a bug in an iOS component?
The UIImagePickerController seems to be involved. It seems to happen shortly after picking a foto via the camera.
EDIT: Here is what the debug navigator is showing right after the crash:
And one more screenshot:
I cannot identify a single action in the app that reproduces the crash. I need to click around in a component that takes a picture from the camera and saves it into a UICollectionView. Only sometimes and eventually, the crash happens at different points.
I've verified that the code inside imagePickerController:didFinishPickingMediaWithInfo:
is running on the main thread.
How can I locate the exact place in my the code where this crash is happening?
EDIT 2: Update from Apple developer technical support; they believe that it is a bug and they suggest filing a bug report.
Upvotes: 1
Views: 1847
Reputation: 5039
In iOS14 UIImagePicker is being deprecated, so I would suggest wrapping your code in an iOS version check and using the new PHPickerViewController instead. Not the best solutions, but it's something.
Upvotes: -1