0

I am trying to enable airplay in my application using setAllowAirplay but its showing below warning.

MPMoviePlayerViewController may not respond to 'setAllowsAirPlay'

So please suggest how can I enable airplay in my application.

Mitesh Khatri
  • 3,935
  • 4
  • 44
  • 67

1 Answers1

2

The warning is there because not all iOS versions and devices include the allowsAirPlay property. The safe way to call it would be like this:

if ([moviePlayerVC.moviePlayer respondsToSelector:@selector(setAllowsAirPlay:)]) {
    [moviePlayerVC.moviePlayer setAllowsAirPlay:YES];
}

I'm pretty sure that this selector will exist on any modern iOS device.

Rob VS
  • 682
  • 7
  • 11