UIWindow avDisplayManager not available on ATV4

Originator:aman
Number:rdar://35450849 Date Originated:
Status: Resolved:
Product:tvOS + SDK Product Version:
Classification:Bug Reproducible:Always
 
I have an ATV4 running tvOS 11.2 beta

I'm updating my app to take advantage of new 11.2 features like AVDisplayManager.

As per the documentation on https://developer.apple.com/videos/play/fall2017/503/, I added the following code to my application:

  if (@available(tvOS 11.2, *)) {
    AVDisplayManager *manager = application.keyWindow.avDisplayManager;
  }

However, on the ATV4 this code crashes with the following error:

  *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWindow avDisplayManager]: unrecognized selector sent to instance 0x102a0f880'

How can I make my code run on both ATV4 and ATV4K?

Comments

We have determined that this is an issue for you to resolve.

The workaround is to explicitly link to AVKit (go to the target “Build Phases” > “Link Binary with Libraries”, and add AVKit.framework).

The other way to avoid this linker problem is to explicitly create an AVKit object, however if you aren’t using AVPlayerViewController for playback, this workaround doesn’t make much sense.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!