这适用于 Swift 1,但在 Swift 2 中报告错误:
let image:UIImage = UIImage(named: getStringForLanguage(french: "lock_en", english: "lock_fr.") as! String)!
let albumArt = MPMediaItemArtwork(image: image)
let songInfo: NSMutableDictionary = [
MPMediaItemPropertyTitle: "",
MPMediaItemPropertyArtist: "",
MPMediaItemPropertyArtwork: albumArt
]
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = songInfo // this reports the error
错误信息:
无法将“NSMutableDictionary”类型的值分配给“[String : AnyObject]?”类型的值