MPMediaItemArtwork init(image:) deprecated in iOS 10.0

后端 未结 4 1010
执笔经年
执笔经年 2021-02-13 16:35

Apple has deprecated init(image:) method in MPMediaItemArtwork in iOS 10. What is the new alternative.

the class shows interface shows method

4条回答
  •  梦谈多话
    2021-02-13 17:07

    You can use the following code:

    let image = UIImage(named: "logo")!
    let artwork = MPMediaItemArtwork.init(boundsSize: image.size, requestHandler: { (size) -> UIImage in
            return image
    })
    

    And, yes, "now playing" metadata shows on the control center in the simulator.

提交回复
热议问题