Unity Ios: UnityFramework: -[UnityAppController pickStartupWindowScene:]

Please Help, I have:

  • Unity 2020.3.26

  • Apple Pro m1 2020

  • xCode 13.2.1

And I have this crash log from xcode on game in appleStore

Are you using CloudKit? or something that could be sending push notifications to the device?

This might be related to pickStartupWindowScene not finding a scene to attach to, if that the case upgrade Unity or patch method in UnityAppController.mm this might help:

UIWindowScene *foregroundScene = nil, *backgroundScene = nil;

else if (scene.activationState == UISceneActivationStateBackground)
backgroundScene = windowScene;

return foregroundScene ? foregroundScene : backgroundScene;

mentioned fix landed in Unity versions:
2019.4.37f1
2020.3.31f1
2021.2.14f1
2022.1.0b10

2 Likes

I’m getting this crash on a tester that had the game off… how is this possible?

Incident Identifier:
Hardware Model: iPhone10,5

Version: 1.01.1 (123)
AppStoreTools: 13E114
AppVariant: 1:iPhone10,5:15
Beta: YES
Code Type: ARM-64 (Native)
Role: Non UI
Parent Process: launchd [1]

Date/Time: 2022-04-05 09:55:14.0665 +0200
Launch Time: 2022-04-05 09:55:09.5350 +0200
OS Version: iPhone OS 15.0.2 (19A404)
Release Type: User
Baseband Version: 5.00.00
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0

Last Exception Backtrace:
0 CoreFoundation 0x180cf5cac __exceptionPreprocess + 216 (NSException.m:200)
1 libobjc.A.dylib 0x197d64758 objc_exception_throw + 56 (objc-exception.mm:565)
2 Foundation 0x1824cc61c -[NSAssertionHandler handleFailureInMethod:hushed:bject:file:lineNumber:description:] + 196 (NSException.m:242)
3 UnityFramework 0x105d1eb78 -[UnityAppController pickStartupWindowScene:] + 492 (UnityAppController.mm:328)
4 UnityFramework 0x105d1edc0 -[UnityAppController application:didFinishLaunchingWithOptions:] + 400 (UnityAppController.mm:353)
5 UnityFramework 0x1061a6d34 0x105d0c000 + 4828468
6 UIKitCore 0x1832d734c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 352 (UIApplication.m:2292)
7 UIKitCore 0x1834ae624 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3456 (UIApplication.m:2704)
8 UIKitCore 0x18349780c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1216 (UIApplication.m:4437)
9 UIKitCore 0x1833039ec -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 148 (_UISceneLifecycleMultiplexer.m:452)
10 UIKitCore 0x183166b00 _UIScenePerformActionsWithLifecycleActionMask + 96 (_UISceneLifecycleState.m:109)
11 UIKitCore 0x18328b9f4 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 196 (_UISceneLifecycleMultiplexer.m:565)
12 UIKitCore 0x1833a2284 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 368 (_UISceneLifecycleMultiplexer.m:517)
13 UIKitCore 0x1835cf064 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 732 (_UISceneLifecycleMultiplexer.m:564)
14 UIKitCore 0x18355edac -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 336 (_UISceneLifecycleMultiplexer.m:470)
15 UIKitCore 0x1831679e8 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block… + 188 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:73)
16 UIKitCore 0x1832242f8 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 812 (BSAnimationSettings+UIKit.m:50)
17 UIKitCore 0x183169778 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 248 (_UISceneSettingsDiffAction.m:23)
18 UIKitCore 0x18324f530 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 356 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:58)
19 UIKitCore 0x1836abbec __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.573 + 772 (UIScene.m:1775)
20 UIKitCore 0x183197f80 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248 (UIScene.m:1476)
21 UIKitCore 0x1831da3ec -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 264 (UIScene.m:1742)
22 UIKitCore 0x183308684 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 548 (UIApplication.m:3900)
23 UIKitCore 0x18324d94c -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 360 (UIApplicationSceneClientAgent.m:45)
24 FrontBoardServices 0x1916eafc4 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 412 (FBSScene.m:439)
25 FrontBoardServices 0x19170d550 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 + 100 (FBSWorkspaceScenesClient.m:384)
26 FrontBoardServices 0x1916cd714 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232 (FBSWorkspace.m:352)
27 FrontBoardServices 0x1916ceb1c __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 312 (FBSWorkspaceScenesClient.m:383)
28 libdispatch.dylib 0x1809c22f0 _dispatch_client_callout + 16 (object.m:560)
29 libdispatch.dylib 0x180999f58 _dispatch_block_invoke_direct$VARIANT$armv81 + 212 (queue.c:489)
30 FrontBoardServices 0x1916ced7c FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 40 (FBSSerialQueue.m:157)
31 FrontBoardServices 0x1916ce300 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 176 (FBSSerialQueue.m:181)
32 FrontBoardServices 0x1916d23f0 -[FBSSerialQueue _performNextFromRunLoopSource] + 24 (FBSSerialQueue.m:194)
33 CoreFoundation 0x180d16220 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 (CFRunLoop.c:1972)
34 CoreFoundation 0x180d26248 __CFRunLoopDoSource0 + 204 (CFRunLoop.c:2016)
35 CoreFoundation 0x180c695e8 __CFRunLoopDoSources0 + 256 (CFRunLoop.c:2053)
36 CoreFoundation 0x180c6ea18 __CFRunLoopRun + 768 (CFRunLoop.c:2951)
37 CoreFoundation 0x180c81d8c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
38 GraphicsServices 0x19ad8e9a0 GSEventRunModal + 160 (GSEvent.c:2200)
39 UIKitCore 0x1834b6fa8 -[UIApplication _run] + 1080 (UIApplication.m:3457)
40 UIKitCore 0x18324b22c UIApplicationMain + 2060 (UIApplication.m:5013)
41 UnityFramework 0x105d237c8 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 108 (main.mm:96)
42 SuperCitycon 0x100d23cac main + 536 (main.mm:30)
43 dyld 0x100da0190 start + 444 (dyldMain.cpp:876)

I also got an error only in Release Build of ios.
UnityFramework: -[UnityAppController pickStartupWindowScene:]

It was built and updated without any problems until July 2022.
After adding Firebase DynamicLink SDK for Unity (tested 8.1.0, 9.1.0, 9.3.0) in August 2022, the build started having problems.

When I connect iphone in xcode and test by pressing “PlayButton(ReleaseForRunning)” everything works fine.
However, after archiving, uploading and downloading through Test Flight always crashes.

NSAssert(foregroundScene != nil, @“No foreground window scene found at startup”);
“Last Exception Backtrace (0)” occurred in this part.

I applied the code you gave me, but this time an error occurred in another part.
else if (scene.activationState == UISceneActivationStateBackground)
“Last Exception Backtrace (0)” occurred in this part.

Because of this, the update on the App Store side has been impossible for two months.
Please tell me how to solve this problem.

Below is a list of my tests, and all of them have the same error.
Unity2020.3.29, 2020.3.38
xcode 13.3, 13.4, 13.4.1
Please give me any hints to solve this.




I think I am having similar issues but we didn’t update any SDK/Unity since approx June 2022. Now after IOS16 came out we saw a spike in people that cannot launch the game both stores and crashes on Organizer, nothing on Raygun.

How to apply that patch into that class?

Will that solve the issue?

Today I tested in a new direction.
I used the final version (220705) that is well served in the App Store.
After running only ‘Reimport All’ once, it was built, archived in xcode, and downloaded from Test Flight.
Just this alone gave the error UnityFramework: -[UnityAppController pickStartupWindowScene:] .

If I download version 220705 as Test Flight after build without ‘Reimport all’, it works normally.

Hope this can be a hint to solve the problem.

I have attached a list of packages used in my project.

I built with xcode by adding all SDKs and add on sequentially from the sample project.
Finally, I found that the Facebook Mediation AddOn was causing this problem.

Updating Facebook Mediation AddOn to MetaAudienceNetworkUnityAdapter-3.8.0 solved the problem.