ios - AirPlay 没有出现在 iOS 10 中

标签 ios objective-c ios10 airplay

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

在 iOS 9 中,我使用这段代码来检测 Airplay 设备。对于部署目标 10.00,它不会出现。在控制中心,我可以找到我的 airplay 设备,但在我的应用程序中,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];

最佳答案

来自苹果文档:

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/

相关文章:

javascript - 谷歌地图登录混合应用卡住了

ios - 验证失败后提示用户再次通过 UIAlertController 输入内容会在日志上显示警告

iphone - 带有目标的标签到另一个 View

css - ionic - 在 iOS 10 的输入字段中复制/粘贴不起作用

ios - 按住并释放按钮代码继续运行第一个动画完成 block

objective-c - iOS 中的动画背景

ios - UINavigationController 和后退按钮标题

ios - swift/Objective-C : How to get value from object by string name

iOS 10 ScrollView 不工作

audio - 使用语音框架iOS从音频文件生成字幕