libdispatch.dylib`_dispatch_assert_queue_fail in iOS 14

App is running video and before that its displaying the Ad using the Freewheel SDK. Its asking about the location permission before playing the ad. once user gave permission,ad started playing and after the few second it getting crashed. It not reproducible 100%.I am not able to find out why UI update happened in other than main thread. How to debug that.

Below are the StackTrace.
  • thread #34, name = 'WebThread'

 * frame #0: 0x00000001083ce074 libdispatch.dylib_dispatch_assert_queue_fail + 99   frame #1: 0x00000001083ce00c libdispatch.dylibdispatch_assert_queue + 152
  frame #2: 0x00007fff24ba402e UIKitCore-[UIImageView _mainQ_beginLoadingIfApplicable] + 65   frame #3: 0x00007fff24b9ce98 UIKitCore-[UIImageView setHidden:] + 66
  frame #4: 0x00007fff23fb60d4 UIKitCore-[UIButton _updateImageView] + 539   frame #5: 0x00007fff23fb6b39 UIKitCore-[UIButton layoutSubviews] + 379
  frame #6: 0x00007fff24bf25b8 UIKitCore-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2924   frame #7: 0x00007fff27aa2c33 QuartzCore-[CALayer layoutSublayers] + 258
  frame #8: 0x00007fff27aa91a5 QuartzCoreCA::Layer::layout_if_needed(CA::Transaction*) + 575   frame #9: 0x00007fff27ab4f47 QuartzCoreCA::Layer::layout_and_display_if_needed(CA::Transaction*) + 65
  frame #10: 0x00007fff279f4408 QuartzCoreCA::Context::commit_transaction(CA::Transaction*, double, double*) + 496   frame #11: 0x00007fff27a2b1ef QuartzCoreCA::Transaction::commit() + 783
  frame #12: 0x00007fff27a2c3ab QuartzCoreCA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 79   frame #13: 0x00007fff2038e1f8 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
  frame #14: 0x00007fff20388a77 CoreFoundation__CFRunLoopDoObservers + 547   frame #15: 0x00007fff20388752 CoreFoundationCFRunLoopRunSpecific + 691
  frame #16: 0x00007fff29b88635 WebCoreRunWebThread(void*) + 581   frame #17: 0x00007fff60c8e109 libsystem_pthread.dylib_pthread_start + 148
  frame #18: 0x00007fff60c89b8b libsystem_pthread.dylib`thread_start + 15
libdispatch.dylib`_dispatch_assert_queue_fail in iOS 14
 
 
Q