Correct UIScene Configuration for UISceneAccessory

What is the correct configuration of the Info.plist to get a UISceneAccessory to display on an external monitor?

I'm currently getting: Info.plist contained no UIScene configuration dictionary (looking for configuration named "scene-accessory")

My Info.plist looks as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>UIApplicationSceneManifest</key>
	<dict>
		<key>UIApplicationSupportsMultipleScenes</key>
		<true/>
		<key>UISceneConfigurations</key>
		<dict>
			<key>UIWindowSceneSessionRoleExternalDisplayNonInteractive</key>
			<array>
				<dict>
					<key>UISceneDelegateClassName</key>
					<string>$(PRODUCT_MODULE_NAME).AccessorySceneDelegate</string>
					<key>UISceneConfigurationName</key>
					<string>scene-accessory</string>
				</dict>
			</array>
			<key>UIWindowSceneSessionRoleApplication</key>
			<array>
				<dict>
					<key>UISceneConfigurationName</key>
					<string>Default Configuration</string>
					<key>UISceneDelegateClassName</key>
					<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
				</dict>
			</array>
		</dict>
	</dict>
</dict>
</plist>

And the view controller scene registration code:

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let sceneConfiguration = UISceneConfiguration(name: "scene-accessory")
        let accessory = UISceneAccessory.externalNonInteractive(sceneConfiguration: sceneConfiguration)
        
        let registration = registerSceneAccessory(accessory)
        registration.isEnabled = true
    }
}

Thanks!

Answered by Engineer in 892655022

Hey there,

This seems unexpected. Could you please file a feedback report with a reproducible sample? You can do so at https://developer.apple.com/feedback-assistant/

In the meantime, you can explicitly specify the scene session role with UISceneConfiguration.init(name:sessionRole:) like so:

let sceneConfiguration = UISceneConfiguration(name: "scene-accessory", sessionRole: .windowExternalDisplayNonInteractive)

This should help resolve the configuration from the Info.plist.

Alternatively, you can also specify your scene configuration entirely in code (instead of the Info.plist) by setting the configuration's delegateClass property like so:

let sceneConfiguration = UISceneConfiguration(name: "scene-accessory", sessionRole: .windowExternalDisplayNonInteractive)
sceneConfiguration.delegateClass = AccessorySceneDelegate.self

— Miguel

Hey there,

This seems unexpected. Could you please file a feedback report with a reproducible sample? You can do so at https://developer.apple.com/feedback-assistant/

In the meantime, you can explicitly specify the scene session role with UISceneConfiguration.init(name:sessionRole:) like so:

let sceneConfiguration = UISceneConfiguration(name: "scene-accessory", sessionRole: .windowExternalDisplayNonInteractive)

This should help resolve the configuration from the Info.plist.

Alternatively, you can also specify your scene configuration entirely in code (instead of the Info.plist) by setting the configuration's delegateClass property like so:

let sceneConfiguration = UISceneConfiguration(name: "scene-accessory", sessionRole: .windowExternalDisplayNonInteractive)
sceneConfiguration.delegateClass = AccessorySceneDelegate.self

— Miguel

Correct UIScene Configuration for UISceneAccessory
 
 
Q