Apple offers a method within the StoreKit framework to detect whether or not the users has an apple music subscription, although, it simply does not work. I have an Apple Music subscription, and can both listen to songs from within my app and can add items to my library from within my app--yet, when I request my capabilities, it does not say I have either. Here is my code:
let serviceController = SKCloudServiceController()
serviceController.requestCapabilities { (capability:SKCloudServiceCapability, err:Error?) in
print("error in capability check is \(err)")
switch capability {
case SKCloudServiceCapability.musicCatalogPlayback:
print("user has Apple Music subscription and can play music from apple music api")
case SKCloudServiceCapability.addToCloudMusicLibrary:
print("user has an Apple Music subscription, can play music from api, also can add to their music library")
case SKCloudServiceCapability.musicCatalogSubscriptionEligible:
print("user does not have subscription")
default:
print("default and capability is \(capability.rawValue)")
}
}
Every time I run my app, it prints "default and capability is 257." I've tried uninstalling/reinstalling probably a dozen times--the same every time.
Note, I can indeed get my user token and add songs to my library via the Apple Music api.
Anyone else experienced this, and is there another workaround to see whether the user has an Apple Music subscription?