I'm looking into the new APIs in MPMediaLibrary in iOS 9.3 and running into a few issues.
I am using SKCloudServiceController to request authorization and then check for the AddToCloudMusicLibrary capability. I then request authorization to the MPMediaLibrary (which appears not to do anything as the SKCloudServiceController auth already does that as far as I can tell...) and then try and do the following:
MPMediaLibrary.defaultMediaLibrary().addItemWithProductID(self.trackID, completionHandler: { (entities, error) in
})
This is giving me the following error:
Error Domain=MPErrorDomain Code=2 "The requested operation is not enabled for this device." UserInfo={NSLocalizedDescription=The requested operation is not enabled for this device.}
Initially I thought it may be a problem with my product ID although this doesn't seem to be the case as I can play the track just fine using the new setQueueWithStoreIDs method on MPMusicPlayerController.
There is very little in the way of documentation for these new APIs but I'm doing everything correctly as far as I can see. Can anyone shed some light on how I can add Apple Music tracks to the user's iCloud library?