Search code examples
iosin-app-purchasestorekit

StoreKit Sandbox Purchase Fails with "Confirm your IAP" Dialog ("Cannot connect to iTunes Store" code 0)


UPDATE: The issue resolved itself. It looks like it was a problem on Apple's end.


I am trying to test my implementation of In-App Purchases with StoreKit:

  • Using an actual device,
  • With multiple sandbox accounts created on iTunes Connect, after having signed out of my actual account on the App Store on my iOS device,
  • With a non-consumable product.

However, I am getting a bizarre error; the transaction fails right after though the App Store "Confirm your IAP" alert shows up. Here is a synopsis after hours of debugging:

  1. In viewDidLoad, I add the view controller instance (self) as an observer to the SKPaymentQueue, and start a SKProductsRequest, again setting its delegate to self.
  2. In productsRequest(_:didReceive:), I store the SKProduct object in the view controller. UI updates as necessary.
  3. The user taps a button which purchases the product, by instantiating an SKPayment object and adding it to the SKPaymentQueue.
  4. paymentQueue(_:updatedTransactions:) receives a transaction object with transactionState as .purchasing. All good so far.
  5. The App Store dialog pops up and asks the user to sign in to iTunes, and then to "Confirm your IAP [Environment: Sandbox]".
  6. Immediately after the latter dialog pops up, with no user input, paymentQueue(_:updatedTransactions:) receives a transaction object with transactionState as .failed. The error property indicates that the device "Cannot connect to iTunes Store" with an error code of 0.

I have tried doing the same with fresh iTunes Connect Sandbox accounts and on multiple devices, but the results are always the same. What should I do?

The IAP on iTunes Connect is marked "Ready To Submit", so I don't think it's because I didn't configure it correctly on ITC.

Simplified Gist

Edit: To elaborate, IAPs worked before. I tried running previous versions of my code, when it used to work, but the same error occurs.


Solution

  • It's not you. There are dozens of other developers who are having the same issue right now. Largest list active list of issues is here.

    The timing of the problem coincides with the release of iOS 10.3 and XCode 8.3. Along with Apple Pay being rolled out in Taiwan. It's an issue with Apple's back end servers. The best we can do is file a bug report and wait.