MPMediaLibrary not working properly - iOS 14 beta

I'm using the MPMediaLibrary's addItem(withProductID:completionHandler:) function:

https://developer.apple.com/documentation/mediaplayer/mpmedialibrary/1621278-additem

but the completion is never called, no matter where I call it in my code, regardless if the item was or wasn't already in the user's library. Has the API changed or is this a beta issue?
Answered by Slin in 631521022
I am having the same issue, it worked fine with an older beta, but always hangs with beta 7 (I didn't update for a while, so I don't know when it started).
@davenorfleet Thanks for the workaround! I'm gonna have to try and tweak these, as it seems that sometimes the playlist fails to add the song (knowing MusicKit, I probably have to add a 0.1 seconds timer before calling the completion). But what's important is that I managed to get past the bug! :D Thanks!
Guys, I found the fix. Calling MPMediaLibrary.default().addItem(...) never reaches completion when called on the main thread. However, I wrapped it in a DispatchQueue.global(qos: .utility) {} and this made it work.
@RobertManea thank you
@RobertManea,

DispatchQueue.global(qos: .utility).asych {

MPMediaLibrary.default().addItem(...)

}


That fixes the issue and worked out for me. Long wait for this issue to fix. Thank you very much.
MPMediaLibrary not working properly - iOS 14 beta
 
 
Q