1

requestUserTokenForDeveloperToken return error

if (@available(iOS 11.0, *)) {
    [self.cloudServiceController requestUserTokenForDeveloperToken:developerToken completionHandler:^(NSString * _Nullable userToken, NSError * _Nullable error) {

                            NSLog(@"userToken error - %@", error);

                        }];
                    }

Error:

Error Domain=SKErrorDomain Code=7 "(null)" UserInfo={NSUnderlyingError=0x1c105e870 {Error Domain=SSErrorDomain Code=109 "(null)" UserInfo={NSUnderlyingError=0x1c105e180 {Error Domain=SSErrorDomain Code=109 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store, SSErrorHTTPStatusCodeKey=401}}}}}

How can I solve this problem? Thx!

  • I'm getting an error `NSURLErrorDomain Code=-999 "Cannot connect to iTunes Store"` with this code. It references the URL endpoint for `createMusicToken`. Any ideas? – Dan Healy Oct 12 '17 at 00:02
  • I believe I was getting the 999 error due to trying to send simultaneous SK requests. I am still struggling with a 401 error though. I've verified that the developer token I'm generating works with the Apple Music API, but it gets rejected in this call to `requestUserTokenForDeveloperToken` – Dan Healy Oct 13 '17 at 17:49

1 Answers1

2

I solved the problem, the problem was in the developer token, it was not properly created. I recreated the token using this utility https://github.com/pelauimagineering/apple-music-token-generator and it all worked ;)