ios - MPNowPlayingInfoCenter 适用于模拟器,但不适用于设备

标签 ios xamarin

我在我的应用程序中使用 AVPlayer。MPNowPlayingInfoCenter 适用于模拟器。但在真实设备上,它不适用于控制屏幕音乐播放/暂停按钮。

最佳答案

要启用远程控制事件,您应该使用 beginReceivingRemoteControlEventsUIApplication .例子:

UIApplication.sharedApplication().beginReceivingRemoteControlEvents()

如果在某个时候您想停止接收事件,请调用:
UIApplication.sharedApplication().endReceivingRemoteControlEvents()

要处理远程事件,您应该实现 remoteControlReceivedWithEvent :
override func remoteControlReceivedWithEvent(event: UIEvent) {
    // Your implementation
}

关于ios - MPNowPlayingInfoCenter 适用于模拟器,但不适用于设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32284001/

相关文章:

iphone - AVAssetExportSession estimatedOutputFileLength 总是返回 0

android - Xamarin.Android : CS0103 The name 'SetSupportActionBar' does not exist in the current context

android - Xamarin.Forms System.ArgumentException : Illegal characters in path

ios - 对于 Uiimageview 如何将 CGgradient 背景色设置为 ios swift 4 中的背景色?

ios - 如何在 iOS Swift 中为 CMSampleBufferGetFormatDescription 创建一个AudioSampleBuffer

visual-studio - Visual Studio 2017 - 磁盘空间不足

c# - 延迟几秒多次更新 Textview 文本

xamarin.ios - 如何为 Mv uiCollectionViewController 提供页眉或页脚?

ios - 在应用程序中使用 Google map 中的转弯导航

ios - 应用内 iOS "Confirm your in app purchases"会弹出购买 ListView