In app purchase “Cannot connect to iTunes Store” error for Sandbox user

We're using sandbox for testing auto renewing IAP but most of the time it's returning error saying 'Cannot connect to iTunes store'.


We've followed steps mentioned in following document : https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/ShowUI.html#//apple_ref/doc/uid/TP40008267-CH3-SW11


The System Status for iTunes Sandbox is showing Green (good) right now, but it still doesn't work for me.

Replies

Not sure if there is a work around for this. I ran a ping test to Apple's sandbox servers and I'm getting 100% packet loss. Results are below:


Ryans-MacBook-Pro:~ ryandurkin$ ping -c 5 sandbox.itunes.apple.com

PING sandbox.itunes-apple.com.akadns.net (17.154.66.159): 56 data bytes

Request timeout for icmp_seq 0

Request timeout for icmp_seq 1

Request timeout for icmp_seq 2

Request timeout for icmp_seq 3


--- sandbox.itunes-apple.com.akadns.net ping statistics ---

5 packets transmitted, 0 packets received, 100.0% packet loss

System status said "Ok", however it's not.



PING sandbox.itunes-apple.com.akadns.net (17.154.66.159): 56 data bytes

Request timeout for icmp_seq 0

Request timeout for icmp_seq 1

Request timeout for icmp_seq 2

Request timeout for icmp_seq 3

Request timeout for icmp_seq 4

Request timeout for icmp_seq 5

Request timeout for icmp_seq 6

Request timeout for icmp_seq 7

Request timeout for icmp_seq 8

^C

--- sandbox.itunes-apple.com.akadns.net ping statistics ---

It appears that the issue with sandbox testing affects some of you, but not everyone. It also turns out the the use the ping command can indicate a false positive for the problem. We’ve identified cases where the ping fails, but the In-App Purchase app is able to connect with the sandbox server and complete transactions.


In order to investigate this issue, the iTunes Server engineers have asked that bug reports be submitted with more complete information, including a sysdiagnose archive from the device. Such device will show additional information about the problem which a ping cannot.


First, here are the instructions to capture the sysdiagnose archive - please log into the Apple Developer Bug Report Profiles and log web page - <https:/

If you do this on the test device using the Safari browser, you can install the profiles to the device directly from the web site.

Install the following profiles

1. “App Store/iTunes Store for iOS” profile

2. “sysdiagnose for iOS” profile.

After all profiles are installed, please restart the device.


Please review the instructions for triggering the sysdiagnose profile and how to use iTunes to download the archive file by syncing with the device.

Make sure you are familiar with triggering the sysdiagnose log, then perform the steps to replicate the problem. When the failure occurs, trigger the sysdiagnose profile, wait 5 minutes, then sync the device with the iTunes app and find the sysdiagnose archive file. While reproducing the problem it will help to capture screenshots showing evidence of the connection failure.


To submit the bug report, please follow these instructions. Please use the Apple Developer Bug Report web page - http:/

After logging in, select the Product “Other”.

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

make sure to include the application ID

add a sequence of steps that a new user will take to use the app to find the In-App Purchase item

describe the evidence provided by the app that a network failure occurred. If there is a delayed response, indicate the approximate delay time.

Please include the sysdiagnose archive as an attachment to the bug report.

If you have a TestFlight build of the sandbox version of the app, please send an invitation to “apps_test@icloud.com”. Please include the bug report number in the invitation so that the test engineer knows which bug report to associate with the invitation.


Thank you for your assistance with this matter.

rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Do you know ETA for the sandbox issue?


https://developer.apple.com/system-status/

Same question. What restrictions are being disabled/enabled? Bug report 39792543 submitted.

We are having similar issue with our App. When we test in in Sandbox environment, the in-app purchase works fine all the time, but when we submit the app for review, the app gets rejected because the purchase would not complete with error (Cannot connect to iTunes Store error is 2). Our app got rejected twice already. We have no idea how to troubleshoot. Has anyone seen this issue occurring only during the app review and were able to get past it?


We also opened a bug report with problem id 44422812.

I was getting this issue with new Sandbox accounts created as of 10/04/2018. Sandbox accounts that were created before did work however.

I'm going to create a new test user account to test with, however I wonder whether this problem persists when a TestFlight version of the app is tested with older App Store accounts.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

I've finally replicated the issue by taking a hint post above by seansy. I created a new test user account. Then I attempted the in-app purchase and it failed when I used the new test user account. Since I was using iOS 12 on my iPhone, i also found that when I entered the Settings app -> iTunes & App Store -> Sandbox Acct setting

and entered my new test user account credentials, the test user field remained blank. When I entered a test user account which I'd been using for a while, the test user field was updated. I captured the console log for both cases and observed a "failure to authenticate" error prior to the call to the updatedTransactions method.


I've submitted bug report rdar://45059292to document this problem.


For those that are experiencing this problem. If you have iOS 12, are you able to replicate the problem in the Settings app.


As a workaround suggestion, if you can submit a TestFlight build so that you can use your existing iTunes accounts(created before Sept '18) in sandbox mode, I would expect that things will work. If not, this would be another bug report issue.


rich kubota - rkubota@apple.com


developer technical support CoreOS/Hardware/MFI

Thanks, Rich, this was helpful. I tried an old sandbox account and it worked in my iOS 12 app in debug mode. For whatever reason it only worked the second time I launched the app. The first time, the login dialog with username and password kept coming indefinitely.


The second time, I only had to enter the password once to confirm the purchase—as it should be. Also, I verified that in the App Store settings, the sandbox account is memorized correctly.


When using a new sandbox account I can confirm that the purchase request fails and the account is not memorized in the App Store settings.


However, memorization in the App Store settings never works (with old and new accounts) directly in the App Store settings app. It only works when authenticating within the app with an old sandbox account.


This sandbox system really is terribly fragile. It seems to only work at full moon when a black cat walks from the left side over the street!

Thanks Rich.
Can you give us any guidance on going through the review process? We have a live app in the store right now that we are adding In-App Purchases functionality with next release. Our app is rejected due to this issue. Apple review team is not able to test it as their sandbox account is experiencing the same issue. we are stuck.
Thanks in advance

I have the same issue in iOS 11.

I have the same issue on iOS 11 & 12

Thank you


Unfortunately, I'm experiencing this issue.


I was able to test the In-App Purchase in sandbox with an old account using TestFlight as you suggested, but it simply does not work with recently created sandbox accounts.


The app keeps being rejected due to this.

Lukos86


App Review should not be seeing this issue as they are using older accounts. If AR is rejecting the app something else is the issue.


rich kubota - rkubota@apple.com


developer technical support CoreOS/Hardware/MFI