Failed transaction appears in the payment queue when user tries to buy product in sandbox environment

Originator:srinidhis119933
Number:rdar://FB7647502 Date Originated:04/01/2020
Status:Closed Resolved:
Product:StoreKit Product Version:12, 13
Classification:Incorrect/Unexpected Behavior Reproducible:Sometimes
 
I have created an iOS app with in-app purchase enabled.
In the sandbox mode, when the user tries to buy a product it is observed that sometimes failed transaction is added to the SKPaymentQueue.

When user taps on buy button, the following code is run
    func buy(product: SKProduct) {  
        let payment = SKPayment(product: product)  
        SKPaymentQueue.default().add(payment)  
    }

Afterwards, the method `paymentQueue(_:updatedTransactions:)` of the registered SKPaymentTransactionObserver is called with a failed transaction.


The error object of the transaction is as follows-
 
Cannot connect to iTunes Store Error Domain=NSURLErrorDomain Code=-1200 "Cannot connect to iTunes Store" UserInfo={_kCFStreamErrorDomainKey=3, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask<E979C8A8-8B0B-498D-B086-212B6AFF4B3E>.<2>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://sandbox.itunes.apple.com/WebObjects/MZFinance.woa/wa/inAppBuy, _NSURLErrorRelatedURLSessionTaskErrorKey=("LocalDataTask <E979C8A8-8B9B-498D-B0860212B6AFF4B3E>.<2>"), NSLocalisedDescription=Cannot connect to iTunes Store, NSErrorFailingURLStringKey=https://sandbox.itunes.apple.com/WebObjects/MZFinance.woa/wa/inAppBuy,NSUnderlyingError=0x280ad8060 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCGStreamSSLErrorOriginalValue=-9816, _kCGStreamErrorDomainKey=3, _kCGStreamErrorCodeKey=-9816}}, _kCGStreamErrorCodeKey=-9816}

In the attached sysdiagnose file, the issue can be observed around 1st April 2020, 10:14 AM +0530.

Comments

This line is being added because the system is asking for "Add More Information"

By srinidhis119933 at April 1, 2020, 9:42 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!