Apple has deprecated init(image:)
method in MPMediaItemArtwork
in iOS 10.
What is the new alternative.
the class shows interface shows method below to be available in the new OS version
public init(boundsSize: CGSize, requestHandler: @escaping (CGSize) -> UIImage)
Anyone know how to use it?
Also question 2, part of the previous question: Does showing now playing metadata on the lock-screen and control-center using MPNowPlayingInfoCenter
work in the simulator?
I was wondering the same and ended up finding Apple's explanation for this.
They say we shouldn't do any expensive resizing operations on the image when handler is requested, but instead simply return the closely matching image out of ones already available to you.
The following WWDC 2017 video is where they mention it. It's about tvOS, but at least we get some insight. Starts at 07:20: https://developer.apple.com/videos/play/wwdc2017/251/?time=440
I saw this just now and I'm confused too, but I guess this is the right way:
The method - in my case in a singleton "Manager"-Class
You can use the following code:
And, yes, "now playing" metadata shows on the control center in the simulator.
Minimum code: