SKCloudServiceController requestUserToken(forDeveloperToken:completionHandler:) returns SKErrorDomain 7

Originator:ben
Number:rdar://33586163 Date Originated:2017-07-28
Status:Duplicate/33129483 Resolved:
Product:StoreKit Product Version:iOS 11b4
Classification:Serious Bug Reproducible:Always
 
Area:
StoreKit

Summary:
When trying to fetch a userToken from SKCloudServiceController an SKErrorDomain error 7 is always returned. As it is fetching from a web service, it is expected that it won't always be available 100% of the time but I haven't been able to retrieve a valid token in several weeks. This doesn't seem to be limited to a change in the iOS 11 beta as I was able to retrieve a token in beta 3 but then it stopped working in beta 3 with no code change - definitely feels like an issue on the server side which the SKErrorDomain 7 alludes to.

There are several people having the same issue:

- https://forums.developer.apple.com/thread/82454
- https://forums.developer.apple.com/message/244924

Steps to Reproduce:
1. Request access to the user's Apple Music account / media library using SKCloudServiceController.requestAuthorization

2. Fetch a developer token from my server at https://clients.dodoapps.io/playlist-precis/generate-token.php

3. Request a user token with:

let controller = SKCloudServiceController()
        controller.requestUserToken(forDeveloperToken: developerToken) { (userToken, error) in {

}

Expected Results:
At this point I should have a userToken to use with the Apple Music API

Observed Results:
The operation couldn't be completed (SKErrorDomain error 7)

Version:
iOS 11 developer beta 4 (15A5327g)

Notes:
sysdiagnose attached. Error occurred at 09:11 BST within the app 'UserTokenTest'. I have also attached an example project to reproduce the issue.

Configuration:
Tested on iPhone 5S and iPad Pro (1st gen 12.9") running both iOS 11 developer beta 3 and developer beta 4.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!