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.
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