requestUserToken SKErrorDomain Code=9 "The latest Apple privacy policy has yet to be acknowledged"

I'm working on an app that communicates with the Apple Music API. I'm attempting to run the app on a simulator (ios 14.2). When I run this code:
Code Block
SKCloudServiceController().requestUserToken(forDeveloperToken: developerToken) { (receivedToken, error) in
      print(receivedToken ?? "No Token")
      print(error)
      guard error == nil else { return }
      // the rest of the code that never gets called ...
    }

It prints this error:
Code Block
Error Domain=SKErrorDomain Code=9 "The latest Apple privacy policy has yet to be acknowledged" UserInfo={NSLocalizedDescription=The latest Apple privacy policy has yet to be acknowledged}


And obviously I get no user token.

How do I Acknowledge the latest Apple privacy policy?

I am signed in with my apple Id in my simulator. I can use apple music on my regular iPhone and I can use Apple Music on OS X without Apple asking me to acknowledge Privacy Policy. Is there some way of provisioning user data on the app for testing purposes?





You cannot successfully test this code on an xCode simulator. You need to use a real device (iPhone/iPad).

That being said, you could make sure that you have the correct settings in your info.plist:

Privacy - Media Library Usage Description -> set string value describing what needs authorization.

Hello @philm00re,

@markinson04's response is essentially correct.

The functionality exposed in SKCloudServiceController requires being tested on a physical device.

It's also true that you need to include a usage description string in your app's Info.plist associated with the key Privacy - Media Library Usage Description, but this will not help with trying to fetch a user token for Apple Music API in the simulator.

Best regards,

This is very disappointing. Is there a way to capture User Token to allow for overriding this?

Hello @Chris_Sheridan,

You can always run this code on a physical device, copy the user token, and paste that in your app's code temporarily for testing purposes only before you run it on the simulator.

For a more permanent solution, feel free to file a ticket on Feedback Assistant explaining what you're trying to do, and what changes you'd like to see in our frameworks to support your workflow.

Best regards,

requestUserToken SKErrorDomain Code=9 "The latest Apple privacy policy has yet to be acknowledged"
 
 
Q