This crash is by far topping our crash logs, and we just can't figure out what is causing it. So I turn to you guys for help.
My research in this topic hints that a possible cause is when we're either trying to display an ad at a different orientation than the game is using, or if we resume the app in another orientation than it had when it was minimized. It also looks like this was a thing back in 2016 and was resolved in Unity 5.6.0. This does not help very much though, since we're currently using Unity 2018.4.6f1.
We are unable to reproduce this crash ourselves, but we're seeing tons of crashes like this on Firebase Crashlytics. So that's all we have to go on.
Here's some info that could be relevant:
Unity: 2018.4.6f1
Affected devices: iphone, ipad
Affected OS: iOS 9 - iOS 13
Xcode version: 11.1
Unity player settings configuration:
Default orientation: Auto rotation
Use Animated Autorotation: true
Allowed Orientations for Auto Rotation: Landscape Right, Landscape Left
A typical crash log looks like this:
Crashed: com.apple.main-thread
0 GameApp 0x100533da8 CrashedCheckBelowForHintsWhy + 118 (CrashReporter.mm:118)
1 GameApp 0x102c9563c void firebase::ReferenceCountedFutureImpl::DeleteT<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(void*) + 27033940
2 GameApp 0x1005fe8bc RuntimeInvoker_TrueVoid_tDB81A15FA2AB53E2401A76B745D215397B29F783_RuntimeObject_RuntimeObject(void (*)(), MethodInfo const*, void*, void**) + 22071 (Il2CppInvokerTable.cpp:22071)
3 GameApp 0x10126b4b8 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 539 (Runtime.cpp:539)
4 GameApp 0x10126bdf0 il2cpp::vm::Runtime::CallUnhandledExceptionDelegate(Il2CppDomain*, Il2CppDelegate*, Il2CppException*) + 476 (Runtime.cpp:476)
5 GameApp 0x10126bd7c il2cpp::vm::Runtime::UnhandledException(Il2CppException*) + 632 (Runtime.cpp:632)
6 GameApp 0x100cb5424 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) + 362 (ScriptingInvocation.cpp:362)
7 GameApp 0x100cbcbf0 Coroutine::InvokeMoveNext(ScriptingExceptionPtr*) + 71 (ScriptingInvocation.h:71)
8 GameApp 0x100cbc7c8 Coroutine::Run(bool*) + 257 (Coroutine.cpp:257)
9 GameApp 0x100c09fc0 AsyncOperation::InvokeCoroutine() + 21 (AsyncOperation.cpp:21)
10 GameApp 0x100c26590 PreloadManager::UpdatePreloadingSingleStep(PreloadManager::UpdatePreloadingFlags, int) + 455 (PreloadManager.cpp:455)
11 GameApp 0x100c26ba4 PreloadManager::UpdatePreloading() + 565 (PreloadManager.cpp:565)
12 GameApp 0x100c1b6a8 ExecutePlayerLoop(NativePlayerLoopSystem*) + 347 (PlayerLoop.cpp:347)
13 GameApp 0x100c1b6dc ExecutePlayerLoop(NativePlayerLoopSystem*) + 365 (PlayerLoop.cpp:365)
14 GameApp 0x100c1b8bc PlayerLoop() + 45 (RecursionLimit.h:45)
15 GameApp 0x100e71c24 UnityPlayerLoopImpl(bool) + 272 (LibEntryPoint.mm:272)
16 GameApp 0x10052a898 UnityRepaint + 280 (UnityAppController+Rendering.mm:280)
17 GameApp 0x10052a774 -[UnityAppController(Rendering) repaintDisplayLink] + 72 (UnityAppController+Rendering.mm:72)
18 QuartzCore 0x240809ff0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636
19 IOKit 0x23c6564b0 IODispatchCalloutFromCFMessage + 488
20 CoreFoundation 0x23c36519c __CFMachPortPerform + 188
21 CoreFoundation 0x23c38bda0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
22 CoreFoundation 0x23c38b4ec __CFRunLoopDoSource1 + 440
23 CoreFoundation 0x23c386310 __CFRunLoopRun + 2096
24 CoreFoundation 0x23c3857c0 CFRunLoopRunSpecific + 436
25 GraphicsServices 0x23e58679c GSEventRunModal + 104
26 UIKitCore 0x268a3ec38 UIApplicationMain + 212
27 GameApp 0x100522310 main + 41 (main.mm:41)
28 libdyld.dylib 0x23be498e0 start + 4
And some relevant code snippets from UnityAppController+Rendering.mm:
64 - (void)repaintDisplayLink
65 {
66 #if ENABLE_DISPLAY_LINK_PAUSING
67 _displayLink.paused = YES;
68 #endif
69 if (!_didResignActive)
70 {
71 [self repaint];
72 [self processTouchEvents];
73 }
74
75 #if ENABLE_DISPLAY_LINK_PAUSING
76 _displayLink.paused = NO;
77 #endif
78 }
267 extern "C" void UnityRepaint()
268 {
269 @autoreleasepool
270 {
271 // this will handle running on metal just fine (nop)
272 EAGLContextSetCurrentAutoRestore autorestore(GetMainDisplaySurface());
273
274 Profiler_FrameStart();
275
276 UnityInputProcess();
277 UnityPlayerLoop();
278
279 Profiler_FrameEnd();
280 }
281 }
I'm at a loss here, do you have any insights on what might be causing this? Any ideas how we should proceed to resolve this crash?