SKReceiptRefreshRequest always fails in Xcode 12.2 with .storekit configuration file

Originator:v.silvansky
Number:rdar://FB8907873 Date Originated:Nov 19, 2020
Status:Open Resolved:
Product:iOS SDK Product Version:12.2
Classification: Reproducible:
 
Basic information
Please provide a descriptive title for your feedback:
SKReceiptRefreshRequest always fails in Xcode 12.2 with .storekit configuration file
Which area are you seeing an issue with?
StoreKit Testing in Xcode
What type of feedback are you reporting?
Incorrect/Unexpected Behavior
Description
Please describe the issue:
Hi!

When I run the app with `.storekit` configuration file added to scheme in Xcode 12.2 (latest AppStore version) / iOS 14.2 Simulator, my `SKReceiptRefreshRequest` always fails, I get an error in my `func request(_ request: SKRequest, didFailWithError error: Error)` delegate method.

Same error happens when I run my StoreKit tests with `.storekit` file configured.

Everything worked fine on previous Xcode release, so I suggest this is a regression. I restarted both simulator adn Xcode, but that didn't help.
Please list the steps you took to reproduce the issue:
1. Add correctly set up `.storekit` file to scheme, run the app in iOS 14.2 Simulator
2. Run `SKReceiptRefreshRequest` at some point (I use the button for that)
What did you expect to happen?
I expect `SKReceiptRefreshRequest` to finish with success and delegate method func `requestDidFinish(_ request: SKRequest)` to be called
What actually happened?
Delegate method `func request(_ request: SKRequest, didFailWithError error: Error)` is called with this error:

```
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}}}
```

Comments

I doubt that StoreKit requests directly to AppStore instead of processing the request with .storekit configuration. If this is the case, switch off internet connection will produce a different error result.

By sleepyfurious at Dec. 16, 2020, 11:30 a.m. (reply...)

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!