在运行时使用以下代码,我无法将NowPlayingInfo重置为nil:
MPNowPlayingInfoCenter.default().nowPlayingInfo = nil
if MPNowPlayingInfoCenter.default().nowPlayingInfo != nil {
print("3PX: There was a problem Removing nowPlayInfo")
} else {
print("3PX: nowPlayInfo Removed")
}
但是如果我在第一行设置一个断点,则它可以正常工作。有任何想法吗?
答案 0 :(得分:0)
试试看->
let audioSession = AVAudioSession.sharedInstance()
try? audioSession.setActive(false, with: .notifyOthersOnDeactivation)
MPNowPlayingInfoCenter.default().nowPlayingInfo = [:]