I'm trying to call this function to check Apple Music subscription status. I have an active subscription and listen to music on my iPhone.
But when I'm running test app on it, capability
value is not valid.
It should be SKCloudServiceCapability.musicCatalogPlayback
, SKCloudServiceCapability.addToCloudMusicLibrary
, or not set. I can only get raw value = 257
.
func appleMusicCheckIfDeviceCanPlayback()
{
let serviceController = SKCloudServiceController()
serviceController.requestCapabilities { (capability:SKCloudServiceCapability, err:Error?) in
switch capability {
case SKCloudServiceCapability.musicCatalogPlayback:
print("The user has an Apple Music subscription and can playback music!")
case SKCloudServiceCapability.addToCloudMusicLibrary:
print("The user has an Apple Music subscription, can playback music AND can add to the Cloud Music Library")
case []:
print("The user doesn't have an Apple Music subscription available. Now would be a good time to prompt them to buy one?")
default: print("Something went wrong")
}
}
}
What's wrong here?