iOS 14 StoreKit – SKCloudServiceController’s requestusertoken not being called properly

I’ve tried the code and there were two major problems.

First, DispatchSemaphore makes the return line execute too early. Second, original developer token doesn’t work due to latest iOS 14.3 issue.

So, I first erased DispatchSemaphore.

func getUserToken() {
    var userToken = String()
    
    SKCloudServiceController().requestUserToken(forDeveloperToken: developerToken) { (receivedToken, error) in
        guard error == nil else { return }
        
        if let token = receivedToken {
            userToken = token
            print(userToken)
        }
    }
}

Then tweaked developer token following this repository.

Now, it’s printing user token properly. I hope this helped.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top