我正在尝试使用setAllowAirplay在我的应用程序中启用airplay,但它显示在警告下方。
MPMoviePlayerViewController可能无法响应'setAllowsAirPlay'
因此,请建议如何在我的应用程序中启用airplay。
答案 0 :(得分:2)
警告存在,因为并非所有iOS版本和设备都包含allowsAirPlay属性。调用它的安全方式是这样的:
if ([moviePlayerVC.moviePlayer respondsToSelector:@selector(setAllowsAirPlay:)]) {
[moviePlayerVC.moviePlayer setAllowsAirPlay:YES];
}
我很确定这个选择器将存在于任何现代iOS设备上。