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.

Answered by rkubota in 200109022

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

Accepted Answer

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

Glad to hear it's just that. Thanks a ton for the reply!

Actually, it would be neat if when making a sandbox user, you could select a set of error conditions that get cycled through for testing.

I am having this exact problem! So glad to find that someone else is seeing the same problem. In-App purchases were working fine a few days ago, and then all of a sudden I started seeing what you described when I test in-app purchases. On first tap of buy button I get the 'Cannot Connet to iTunes Store' Error. Second press of buy button goes through. I've changed none of my store code to cause this. I'm using non-consumble IAPs.

There is one thing that I would like developer feedback on - is this problem occuring in production apps?? I'm only seeing this problem reported in sandbox'd apps. However, if this issue is happening in production apps, this would be a bug report for App Ops Engineering to investigate.


Here's the instructions for submitting a bug report - but only for production apps where this exact - success - failure - success - failure purchase issue occurs.

To submit a bug report for investigation by App Ops Engineering, please use the Apple Developer Bug Report web page - http://bugreport.apple.com.


After logging in, select the iTunesConnect Product.


Fill out the bug report form. In the description section - add the comment -

Include the application ID and the iTunes Store that you are seeing the problem

Include the steps to find the in app purchase


After you have submitted the bug report, please send me the bug report number and provide a simple description of the problem to remind me of the issue.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Hi Rich,


These last couple of days I've been testing in app purchases with auto renew subscriptions. I have 1 group wtih 4 subscriptions.


With each new sandbox test account, I'm able to successfully subscribe for the first time and upgrade subscriptions. I however run into the following error whenever I attempt to modify my subscription to a subscription of a differing duration. At least that's what I believe is happening. Whenever I see the "Do you want to modify your subscription to..." dialogue I am met with the following failed transaction:


Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store"


I can't for the life of me figure out what's going on. Could my issue be related to the OP's issue?


Thanks

Samuel

Samuel,


This sounds like the same issue reported by others. When the failure occurs, what happens if you attempt the purchase again - does it work??


The issue here is that every odd purchase attempt works, every even purchase attempt fails - that is when using any new test user account. This is a bug report still under investigation by iTunes Production Support.


However, if the third and fourth and remaining purchase attempts fail, this would be a "new" bug report.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Unfortunately I get this error every time I receive the "Do you want to modify your subscription to..." dialogue and then top continue. I receive a failed transaction immediately at that point. If the dialogue starts with "Do you want to upgrade to...", then it succeeds.


It's just difficult to debug when all the other calls seems to work as expected. I use an older device to test with. I'm currently using a 4S running iOS 9.3.5.


Thanks


Samuel

Samuel,

At this point, others can chime in. However if you want my assistance, please submit for a DTS incident.


<https://developer.apple.com/support/technical/>

rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Is anyone still seeing this issue. I can no longer reproduce this problem.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Hi Rich,

I'm receiving this error after subscribing to an IAP with a sandbox user:


RMStore: transaction failed with product and error Error Domain=SKErrorDomain Code=2 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}


This appears to be related to this ticket. Note that if I try to hit subscribe within my app again, it says that the user is already subscribed.


Mark

Rich,

I'm still seeing this problem. I'm using a sandboxed account created roughly in August 2016. I'll keep trying with a different account (older one and a newer one) and post my results here.


Thanks

If this issue remains after creating a new test user account, other are welcome to post their thoughts. However, I can help if you would submit for a DTS incident. <https://developer.apple.com/support/technical/>


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Samuel, please have a look at this thread. If you understood the problem, then your input is very appreciated.

It happened again with my sandbox user account which is created on six months ago;😟

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!

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