iosappdelegateios13uiscenedelegateuiscene

Using UIScenes in iOS 13, how do I AirPlay Mirror a screen (seems to default to external display)


If I compile onto an iOS 12 device (doesn't use UIScene) and AirPlay Mirror to my Apple TV the app is mirrored as expected to the TV.

On an iOS 13 device, it seems to treat it as an external display where it's formatted to fit the screen (but I have no way to control it).

I'd prefer the old functionality of just mirroring it.

How do I accomplish mirroring on iOS 13? I'm digging around in the docs for:

application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration

And in the UISceneConfiguration there's a role property (it has UISceneSession.Role.windowExternalDisplay when I try to AirPlay Mirror) but it doesn't seem to have any value like UISceneSession.Role.windowMirror.


Solution

  • I've been playing around with mirroring and external displays and various possibilities exist with just the right combination of code/settings but certain functionality doesn't seem possible.

    Under iOS 13 (with an app built with a Base SDK of iOS 13), you can get your app to be mirrored on an external display. But making this work prevents your app from showing different content on an external display. Basically your app only mirrors or it only shows a unique scene for an external display.

    If you wish to only have your app be mirrored, then ensure the following:

    1. Remove the application(_:configurationForConnecting:options:) from your App Delegate.
    2. In the Info.plist, make sure there is no entry for the "External Display Session Role" under the "Scene Configuration" section of the "Application Scene Manifest".

    If neither of those two things are part of your app then your app will simple mirror to any external screen when you activate Screen Mirroring on the iOS device.