コマンドセンターをロック画面に表示しようとしていますが、私は目を覚ましていません。このチュートリアルのコードを見て、同じコードを書いても https://github.com/lukagabric/LGAudioPlayerLockScreen
これがコードです
var nowPlayingInfo = [MPMediaItemPropertyTitle: currentPlaybackItem.trackName,
MPMediaItemPropertyAlbumTitle: currentPlaybackItem.albumName,
MPMediaItemPropertyArtist: currentPlaybackItem.artistName,
MPMediaItemPropertyPlaybackDuration: audioPlayer.duration,
MPNowPlayingInfoPropertyPlaybackRate: NSNumber(value: 1.0 as Float)] as [String : Any]
if let image = UIImage(named: currentPlaybackItem.albumImageName) {
nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(image: image)
}
self.nowPlayingInfoCenter.nowPlayingInfo = nowPlayingInfo
誰でも助けることができます