2

I have an app target and a few static libs. Due to some reasons, I moved the SceneDelegate from the app target to one of the static libs.

In the info.plist file, the SceneDelegate is set as $(PRODUCT_MODULE_NAME).SceneDelegate (as shown below)

<dict>
    <key>UIApplicationSceneManifest</key>
    <dict>
        <key>UISceneConfigurations</key>
        <dict>
            <key>UIWindowSceneSessionRoleApplication</key>
            <array>
                <dict>
                    <key>UISceneDelegateClassName</key>
                    <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
                    <key>UISceneConfigurationName</key>
                    <string>Default Configuration</string>
                </dict>
            </array>
        </dict>
        <key>UIApplicationSupportsMultipleScenes</key>
        <true/>
    </dict>
</dict>

This doesn't work now since SceneDelegate is not in the app target anymore. I tried TargetName.SceneDelegate but that just gives me the following error and the screen is black.

[SceneConfiguration] Encoded configuration for UIWindowSceneSessionRoleApplication contained a UISceneDelegate class named "(null)", but no class with that name could be found.

[SceneConfiguration] Info.plist configuration "(no name)" for UIWindowSceneSessionRoleApplication contained UISceneDelegateClassName key, but could not load class with name "TargetName.SceneDelegate".

This stackoverflow answer suggested to use $(SWIFT_MODULE_NAME).SceneDelegate but that didn't work because $(SWIFT_MODULE_NAME)'s default value is the app target i.e $(PRODUCT_MODULE_NAME).

Is there any other way of setting the SceneDelegate in info.plist file?

There's a dynamic way to set the SceneDelegate, using application(configureForConnecting:options) method of the AppDelegate, but the SceneDelegate may not be accessible in the target which has the AppDelegate (Yes, AppDelegate is also moved to a different target).

So, how else can I set the SceneDelegate in the info.plist file?

NightFuryLxD
  • 847
  • 5
  • 15

0 Answers0