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

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;😟