Sandbox IAP Alternates Between Success and [ Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" ]

I have been implementing IAP in my app, and have been trying to test purchases over the last few days. I have tried from scratch following Apple's guidelines, and online tutorials, all the way to using Swifty Storekit and IAPManager.


Here's what happens: I press buy for my consumeable IAP, then there is a sucessful purchase. If I try to buy it again, there failed purchase with the following error:


Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" 
UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}


If I buy it a third time, it works fine. And so on in that pattern.


Observations/testing:

  • Pattern follows between launches
  • Pattern follows across devices
  • Reproduceable in iOS9 & iOS10
  • Using xcode8 and swift3
  • Deleted my previous sandbox testers and created a new one and problem persists
  • Tried vasious waits between purchases, up to 10 minutes, problem persists.


Any ideas on what could cause this? I am suspecting when live it will be fine, but it is really realy odd.

Accepted Reply

After numerous reports of this issue to DTS, I managed to replicate the problem myself. So far as I can tell, the issue occurs only with new test user accounts. If you go to your iTunesConnect account and enter "User and Roles" -> "Sandbox Testers" page, you will see a list of your sandbox test accounts. If you create a new test user account, notice that there is a check mark in the rightmost column, "Apple Pay". Using such a test account appears to trigger this problem. Developers who have older test user accounts (defined prior to June 13. 2016) won't see this problem.


I've submitted a bug report on this matter, but what I need is a TestFlight submission along with a developer test user account. I think I have such a build coming and will forward the issue to iTunes Production Support for investigation by tomorrow. My suspicion is that this will not affect application submissions - App Reivew tests with mostly established production accounts. This problem will get a lot more (and quicker attention) if it happens in the production environment.


I'll see if I can update this posting when I learn that the problem is fixed.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Replies

Yesterday, i was testing in-app purchases without any hickups, but today all of them gives SKErrorDomain Code=0 “Cannot connect to iTunes Store”. I start with logging out under Settings-iTunes & Appstore, then start my app using xcode and perform an in-app purchase of an auto-renewing subscription.

After signing into Appstore, the first dialog to confirm purchase appears with the price and subscription period states. Tapping Continue does no longer show the next dialog to confirm that i understand this is an auto-renewing subscription. The xcode console shows the error instead.

I've tried with various old and newly created sandbox users, no change. Restarted the phone, computer etc - spent almost an entire day with this issue now. Please help!


/Søren

Same problem. With old/new test accounts.

Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}


Updated to iOS 10.3, using xCode 8.3. No luck.

Hi f1ne, I see the same problem with non consumables on my iPad app.

Tried previous builds, same issue.

Nothing changed on my iTunes connect account.. everything worked yesterday and now it does not.

same problem here

This looks like some new issue - different from previous. I'm hearing that the issue occurs in both the sandbox and in the production environments. For anyone who is seeing this issue - it's a bug report.


The first step (because it doesn't hurt to check) if the problem occurs only in the sandbox environment, create a new test user account to see if the problem is reproducible with the new ntest user account.


Assuming that the problem still occurs with the new test user account then submit the bug report as follows. (for those where the problem occurs with a production app, my instructions are simpler but I present them after the instructions the sandbox case.)


SANDBOX APP CASE ONLY

To submit a bug report, you are going to need to provide a means for the Apps Ops Engineering QA team to replicate the problem. You will need to have a TestFlight build ready so that you can send a TestFlight invitation to the Apps Ops Engineering QA team.


Please follow these steps.

1. Use the Apple Developer Bug Report web page - http://bugreport.apple.com to submit the bug report.

Select the “iTunesConnect” product for the new bug report.

2. In the bug report, please include the following

applicationID

steps to find the in-app purchase

iTunes Store that your test user account is associated with - US, Canada, Mexico, Japan, Chine, Germany, etc

Indicate that you will be sending a TestFlight invitation to use to replicate the situation

Indicate that you’ve tested with a new Test User account and that the same error occurred.

3. Save the bug report and send me the bug report number - rkubota@apple.com

4. Please send a TestFlight invitation to “apps_test@icloud.com”. In the invitation, IMPORTANT -please include the bug report number to associate the invitation with in the TestFlight invitation comments


PRODUCTION APP CASE

Please follow these steps.

1. Use the Apple Developer Bug Report web page - http://bugreport.apple.com to submit the bug report.

Select the “iTunesConnect” product for the new bug report.

2. In the bug report, please include the following

applicationID

steps to find the in-app purchase

iTunes Store that your test user account is associated with - US, Canada, Mexico, Japan, Chine, Germany, etc

3. Save the bug report and send me the bug report number - rkubota@apple.com


I will forward the bug report numbers to the Apps Ops Engineering QA team. They will replicate the issue, then forward the bug report to the iTunes Store Serever engineers when the problem will be investigated.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

I'm having the same issue. I just did what rich said and submitted a bug report and made a Test Flight build, however I'm still waiting for the beta to be approved.

Just tested again this morning with a Testflight build and it is still happening.

Created a bug yesterday, emailed rich with #, our devrel also escalated.

I'm seeing the same issue. Following instructions to file bug report.

Facing same issue even with sandbox tester user craeted 4 years ago.

Hi,

Since from Past two days, we are unable to purchase subscription in live environment.

We are able to fetch list of SKProducts via StoreKit API.

As soon as user taps taps on the subscription plan, we add SKPayment to SKPaymentQueue.

- updatedTransactions delegate is called with this error.

"Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}"


Once we encounter this error, Confirm subscription purchase alert shows up on the device.


Is anyone experiencing these issues ? - Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}


Could the Apple team contact me ? Please let me know if you need additional info.


Thanks!

Same here...

And all the problems happend on my app are same as yours. I can get the infomation of SKProducts too, but when I add the payment to payment queue, the transaction observer received error -- "Cannot connect to iTunes Store".

Once we encounter this error, Confirm subscription purchase alert shows up on the device.

Could the Apple fix this bug as soon as possible? 😕

Similiar issue with consumables. I opened a bug here https://bugreport.apple.com/logon, they asked for detailed logs using this way of logging production store on device.

https://developer.apple.com/services-account/download?path=/iOS/iOS_Logs/App_Store_Logging_Instructions.pdf


Mentioning as I think it gets more attention particularly if many bugs with similar repro. (I hope)

Hi, Do you found any solution for this ? Purchase was working fine in sandbox now, In production recepit was pending .

I've been informed by the iTunes Store Server QA team that a patch was applied to the server code for both Sandbox and Production environments. If you are planning to submit a bug report, pease retest the issue one more time. If the problem still occurs, please file a bug report as described in my previous post and let me know via email that the issue persists as of April 3, 2017.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

HI Rich,

Thank you for the response. we are still facing the issue in production. we filed the bug report according to ur suggestion.


Thanks!

Deepthi