OGeek|极客世界-中国程序员成长平台

标题: ios - AirPlay 未出现在 iOS 10 中 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 17:50
标题: ios - AirPlay 未出现在 iOS 10 中

已解决 在 iOS 10.2 中,AirPlay 按钮重新出现并且仍然有效。苹果的恶作剧!

在 iOS 9 中,我使用此代码来检测 Airplay 设备。对于部署目标 10.00,它不会出现。在控制中心,我可以找到我的播放设备,但在我的应用程序中,uiview 没有显示任何内容。 在我的能力范围内,我检查了“背景模式”、音频、AirPlay 和画中画。也许我忘记了这个祝福沙盒的一些新设置? 感谢您的耐心等待

@property (weak, nonatomic) IBOutlet UIView *airplay;

MPVolumeView *myVolumeView = [[MPVolumeView alloc] initWithFrame: airplay.bounds];
[myVolumeView setShowsVolumeSlider:NO];
[myVolumeView setShowsRouteButton:YES];
myVolumeView.transform = CGAffineTransformMakeScale(0.3,0.3);
[myVolumeView setRouteButtonImage:[UIImage imageNamed"myIconAirPlay"] forState:UIControlStateNormal];
[airplay addSubview: myVolumeView];



Best Answer-推荐答案


来自苹果文档:

If there is an Apple TV or other AirPlay-enabled device in range, the route button allows the user to choose it. If there is only one audio output route available, the route button is not displayed. https://developer.apple.com/reference/mediaplayer/mpvolumeview

您是否检查过 var areWirelessRoutesAvailable: Bool { get }MPVolumeView 上返回 true 还是 false?

我认为这是您的按钮不再出现的原因,如果 iOS10 更新破坏了某些 Airplay 设备,直到它们也被更新,这也不是什么新鲜事。

关于ios - AirPlay 未出现在 iOS 10 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40037232/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4