*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23340a5e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff3fbf44b1 objc_exception_throw + 48
2 Foundation 0x00007fff24c45bc4 -[NSISEngine tryToOptimizeReturningMutuallyExclusiveConstraints] + 0
3 Foundation 0x00007fff24c45832 -[NSISEngine _optimizeWithoutRebuilding] + 54
4 Foundation 0x00007fff24c45765 -[NSISEngine optimize] + 100
5 Foundation 0x00007fff24c40484 -[NSISEngine performPendingChangeNotifications] + 82
6 UIKitCore 0x00007fff39b9c01e -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 3642
7 QuartzCore 0x00007fff290756f9 -[CALayer layoutSublayers] + 255
8 UIKitCore 0x00007fff39afbf73 -[_UILabelLayer layoutSublayers] + 55
9 QuartzCore 0x00007fff2907b8db _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
10 QuartzCore 0x00007fff290871c2 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
11 QuartzCore 0x00007fff28fcf25c _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 316
12 QuartzCore 0x00007fff290043d6 _ZN2CA11Transaction6commitEv + 638
13 QuartzCore 0x00007fff2900528e _ZN2CA11Transaction14release_threadEPv + 210
14 libsystem_pthread.dylib 0x00007fff40beb6ab _pthread_tsd_cleanup + 551
15 libsystem_pthread.dylib 0x00007fff40bee655 _pthread_exit + 70
16 libsystem_pthread.dylib 0x00007fff40beb43a _pthread_wqthread_exit + 74
17 libsystem_pthread.dylib 0x00007fff40bea644 _pthread_wqthread + 472
18 libsystem_pthread.dylib 0x00007fff40bea3fd start_wqthread + 13
Since I'm using AVPlayerViewController I can't force using the main thread with DispatchQueue.main. This crash never happens without ads, so I assume something is posted outside the main thread inside the SDK. I tried finding it with Thread Sanitizer and Main Thread Checker, without success. Could you help?
Thanks
Arek
self.playerViewController = [[AVPlayerViewController alloc] init];
[Assert] UIView animation API is being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior.
Eventually the app will crash. I don't know if it's a bug in the IMA SDK, or just misuse on my part, but it's was hard to find, because the stack trace wasn't pointing to anything in my code