1

I'm currently experimenting with the Adding-Content-to-Apple-Music code found here: https://developer.apple.com/musickit/

I'm using: XCode 9 beta 2, iOS 11 (iPhone 5s)

I have a developer token (which works when I query the Apple Music API searching songs etc...) but I now want to use this to exchange for a User Token so I can perform write actions against my Apple Music account.

The test app fires up and allows me to request authentication. From this I can see:

  • MPMedia Library - Authorized
  • SKCloudServicesController - Authorized
  • Capabilities:
    • Add to Cloud Music Library
    • Music Catalog Playback

My next obvious step is to use the developer token to gain the user token. However, as soon as I call the following:

cloudServiceController.requestUserToken(forDeveloperToken: developerToken, completionHandler: completionHandler)

i see the following error in the completionHandler - can anyone help?

2017-07-14 10:05:39.179300+0100 Adding-Content-to-Apple-Music[1326:172100] [MC] Reading from public effective user settings.

2017-07-14 10:05:40.635503+0100 Adding-Content-to-Apple-Music[1326:172299] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""

2017-07-14 10:05:40.636449+0100 Adding-Content-to-Apple-Music[1326:172100] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"

2017-07-14 10:05:40.800933+0100 Adding-Content-to-Apple-Music[1326:172297] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""

2017-07-14 10:05:40.801259+0100 Adding-Content-to-Apple-Music[1326:172299] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)" An error occurred when requesting user token: The operation couldn’t be completed. (SKErrorDomain error 1.)

In Settings > iTunes & App Store on my device I am logged in with my Apple ID. Same goes for Apple Music too.

scgough
  • 5,099
  • 3
  • 30
  • 48
  • Would you mind sharing the steps you went though to generate your developer token? I've done all the steps on the developer portal and have my key. I'm not too familiar with JWT. Do you have to include a library of some sort in the iOS app to generate this? – Jason C. Howlin Jul 26 '17 at 14:23
  • I found this which includes the steps: https://github.com/pelauimagineering/apple-music-token-generator – Jason C. Howlin Jul 27 '17 at 07:15
  • @JasonC.Howlin that's the one Jason - helpful tutorial on the GH page too. – scgough Jul 27 '17 at 07:58

1 Answers1

0

Update on this:

I also posted about this over on the Apple dev forums. It was an error on their side and now appears to be fixed. I can get a UserToken in both iOS 10 and 11 now.

scgough
  • 5,099
  • 3
  • 30
  • 48