Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

431
Views
SSAccountStore: Unable to get the local account. error = Error Domain=SSErrorDomain Code=100

I am having trouble getting access to the users Apple Music. The error I am getting is

 [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-02-04 19:14:37.250467+0900 SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2019-02-04 19:14:37.252008+0900 [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-02-04 19:14:37.252051+0900  SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2019-02-04 19:14:37.253604+0900  SSAccountStore: Unable to get the local account. error = Error Domain=SSErrorDomain Code=100 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}

However the weird part of this code is that I am also able to retrieve the Music User Token. Is there sth that I am missing? Any help is appreciated.

    static func auth(){
        let cloudServiceController = SKCloudServiceController()

        let developerToken = "abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz"


        SKCloudServiceController.requestAuthorization { status in
            guard status == .authorized else { return }
        }

        cloudServiceController.requestCapabilities { capabilities, error in
            guard capabilities.contains(.musicCatalogPlayback) else { return }
        }

        cloudServiceController.requestUserToken(forDeveloperToken: developerToken, completionHandler: { token, error in

            guard let token = token else { return }
            UserDefaults.standard.set(token, forKey: "MUSIC_USER_TOKEN")
            UserDefaults.standard.set(developerToken, forKey: "DEVELOPER_TOKEN")
            print("Music User Token:", token)
        })
    }
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I think you have to call cloudServiceController.requestUserToken once user has authorised after completion handler for SKCloudServiceController.requestAuthorization

over 4 years ago · Santiago Trujillo Report

0

I was having this same issue until I removed Bearer from the beginning of developerToken.

OP's code example has developerToken set to "abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz", so I can only assume if OP is including Bearer at the beginning or not.

So to be more clear, this is what I was doing before:

asyncAskMyServerToGenerateMyAppleMusicDeveloperJWTDevToken { rawDevToken in
    let formattedDeveloperToken = "Bearer \(rawDevToken)"
    SKCloudServiceController().requestUserToken(forDeveloperToken: formattedDeveloperToken)
    { possibleToken, _ in
        if let userMusicToken = possibleToken
        {
            YayIGotIt.forTheWin(userMusicToken)
        }
    }
}

And this is what I did to make it actually work:

asyncAskMyServerToGenerateMyAppleMusicDeveloperJWTDevToken { rawDevToken in

    //Not prepending "Bearer " anymore
    SKCloudServiceController().requestUserToken(forDeveloperToken: rawDevToken)
    { possibleToken, _ in
        if let userMusicToken = possibleToken
        {
            YayIGotIt.forTheWin(userMusicToken) //This actually fires now
        }
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!