媒体信息显示在模拟器中但不显示在真实设备上
Media Info displayed in simulator but doesn't display on real device
我试过使用此代码显示媒体信息:
import MediaPlayer
let audioInfo = MPNowPlayingInfoCenter.defaultCenter()
audioInfo.nowPlayingInfo = [ MPMediaItemPropertyTitle: "Miley_Cyrus_", MPMediaItemPropertyArtist:"artistName"]
如图所示,这在模拟器上运行良好:
但这在真实设备上无法正常工作:
真实设备中没有显示模拟器中显示的媒体信息。我错过了什么吗?
我刚刚找到了解决方法
UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
这工作正常。
引用自HERE。
我试过使用此代码显示媒体信息:
import MediaPlayer
let audioInfo = MPNowPlayingInfoCenter.defaultCenter()
audioInfo.nowPlayingInfo = [ MPMediaItemPropertyTitle: "Miley_Cyrus_", MPMediaItemPropertyArtist:"artistName"]
如图所示,这在模拟器上运行良好:
但这在真实设备上无法正常工作:
真实设备中没有显示模拟器中显示的媒体信息。我错过了什么吗?
我刚刚找到了解决方法
UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
这工作正常。
引用自HERE。