External Display stops working at iOS 27 / Xcode 27

I have an app that connects to an external display, the app controls content for the external display, but the external display is not active and uses the UIWindowSceneSessionRoleExternalDisplayNonInteractive role.

I migrated the app to use UIScene lifecycle last year and everything seemed to be working.

I use

- (UISceneConfiguration *) application:(UIApplication *) application 
configurationForConnectingSceneSession:(UISceneSession *) connectingSceneSession 
                               options:(UISceneConnectionOptions *) options; 

in the AppDelegate to provide the configurations.

But now at XCode 27/ iOS 27, that code is not called when I connect the external display with a dislpay adapter to my iPhone. But the device connects and shows a mirror of my iPhone display.

What's going on?

Answered by SeriousCyrus in 909215022

OK, reading the article again it was easy to fix, I just added the following to my root view controller and it started working again:

@interface MainViewController ()

@property (nonatomic, nullable) UISceneAccessoryRegistration *externalDisplayRegistration API_AVAILABLE(ios(27.0));

@end

@implementation MainViewController

- (void) viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    if (@available(iOS 27.0, *)) {

        // Support for new external display registration
        UISceneConfiguration *sceneConfiguration = [UISceneConfiguration new];
        sceneConfiguration.delegateClass = [MyExternalDisplayWindowSceneDelegate class];
        
        UISceneAccessory *sceneAccessory = [UISceneAccessory externalNonInteractiveSceneAccessoryWithConfiguration:sceneConfiguration];
        self.externalDisplayRegistration = [self registerSceneAccessory:sceneAccessory];
    }
}

The original article provides swift. Be careful to specify your own window scene delegate.

It seems ok to leave the original code where it is so previous versions work too.

I see now, the article https://developer.apple.com/documentation/uikit/presenting-content-on-a-connected-display?language=objc has a new workflow for iOS 27, it would be nice to make the previous method as deprecated it's no longer called!

Accepted Answer

OK, reading the article again it was easy to fix, I just added the following to my root view controller and it started working again:

@interface MainViewController ()

@property (nonatomic, nullable) UISceneAccessoryRegistration *externalDisplayRegistration API_AVAILABLE(ios(27.0));

@end

@implementation MainViewController

- (void) viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    if (@available(iOS 27.0, *)) {

        // Support for new external display registration
        UISceneConfiguration *sceneConfiguration = [UISceneConfiguration new];
        sceneConfiguration.delegateClass = [MyExternalDisplayWindowSceneDelegate class];
        
        UISceneAccessory *sceneAccessory = [UISceneAccessory externalNonInteractiveSceneAccessoryWithConfiguration:sceneConfiguration];
        self.externalDisplayRegistration = [self registerSceneAccessory:sceneAccessory];
    }
}

The original article provides swift. Be careful to specify your own window scene delegate.

It seems ok to leave the original code where it is so previous versions work too.

External Display stops working at iOS 27 / Xcode 27
 
 
Q