SKReceiptRefreshRequest always fails in Xcode 12.2 with .storekit configuration file
Asked Answered
L

1

8

When I run the app with .storekit configuration file in Xcode 12.2 / iOS 14.2 Simulator, my SKReceiptRefreshRequest always fails, I get an error in my func request(_ request: SKRequest, didFailWithError error: Error) delegate method. Here are the logs:

# Printed by some Apple internal framework:

<SKReceiptRefreshRequest: 0x60000320d640>: Finished refreshing receipt with error: Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}

# Error logged by my code:

Failed to refresh app receipt: Error Domain=SKErrorDomain Code=0 "UNKNOWN_ERROR" UserInfo={NSLocalizedDescription=UNKNOWN_ERROR, NSUnderlyingError=0x600003c9a040 {Error Domain=ASDServerErrorDomain Code=5002 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}}}

I run the request as usual:

class ReceiptFetcher: NSObject {

    func fetchReceipt() {
        let request = SKReceiptRefreshRequest(receiptProperties: nil)
        request.delegate = self
        request.start()
    }
}

extension ReceiptFetcher: SKRequestDelegate {
    func requestDidFinish(_ request: SKRequest) {
        LogVerbose("App receipt refreshed!")
        // Handling success
    }

    func request(_ request: SKRequest, didFailWithError error: Error) {
        LogVerbose("Failed to refresh app receipt: \(error)")
        // Handling error
    }
}

Everything worked fine until I upgraded Xcode to 12.2. Now it fails for both Run and Test actions.

I found nothing about ASDServerErrorDomain with code 5002. Any help on that?

Liebig answered 19/11, 2020 at 16:42 Comment(8)
Filed a radar: openradar.appspot.com/FB8907873Liebig
Just adding a confirmation that I'm seeing this in Xcode 12.2 with simulator and I also see the same error testing on device.Surakarta
IAP not work in Simulator. Try real device with sandbox account. How to login sandbox accountBlueness
StoreKitTest framework make it possible to tet IAP on Simulator. And this code worked until Xcode 12.2 update.Liebig
Well, I didn't know that. If so, how about check if the IAP is in a purchasable state. For example, fill in the period and price of the IAP for the subscription type. I am using Xcode 12.2 (12B45b) on real device without problems. Maybe it's a problem with new Xcode and Simulator.Blueness
I'm facing this issue since I installed macOS BigSur. It is only happening to me if there are no purchases against the used apple id in the sandbox. If there is any purchase, then, it doesn't occur and works fine.Spanishamerican
It's coming to me in macOSX, bigSur.Spanishamerican
This is resolved for me in xcode 12.4. never managed to get any feedback from appleCollywobbles
L
1

Everything works again since Xcode 12.4. I hope they won't break this thing again...

Liebig answered 8/3, 2021 at 17:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.