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.

Same for me. My code was working fine and now my SKProductsRequest is failing every time at didFailWithError, with error code 1001, which seems to indicate a time out issue. I haven't changed any of the code since it was last working, so I'm guessing and hoping its an Apple issue.

Yup, it's been that way for almost a week on my side. I checked on the adhoc version of the build that's currently on the appstore, same behavior. Live users are able to purchase stuff, so it's definitely a sandbox issue.


No idea what iTunes team is doing, but they sure are taking their sweet time fixing it.

Same here. This has been failing sporadically for months, sometimes works fine without issue, other times I just can't do any testing and have to just wait for it to start working again. Given how many Apps use InApp purchases you'd think this would work more reliably.

Same here. And we've got our app rejected because of this

To help get attention on this matter, please submit a bug report. Once you've submitted the bug report please send me the bug report number so that I can forward them to iTunes Server engineering. My direct email address is "rkubota@apple.com". If you've already submitted the bug report, please send me the bug report number.


To submit a bug report on this issue, iTunes engineering has requested the following.


First install the StoreKit and sysdiagnose profiles

Install StoreKit profile to an iOS 11+ device

Please login to the Apple Developer Bug Report - Profiles and Logs website

<https://developer.apple.com/bug-reporting/profiles-and-logs/>

Click the “Profile” URL associated with the “App Store/iTunes Store for iOS” item. You will download the “itmsdebugging.mobileconfig” file.

Click the “Profile” URL associated with the "sysdiagnose for iOS" item.

Read the instructions for triggering the sysdiagnose profile. Note where to find the sysdiagnose archive once you've sync'd the device with iTunes.

IMPORTANT - PLEASE RESTART THE DEVICE


CAPTURE THE DEVICE CONSOLE LOG - connect the device to a macOS X Sierra (or newer) system (macOS X 10.12.x)

1. Launch the Console app and select the device in the left side of the Console window

2. Before starting the iOS app, click “Clear”.

3. Start the application and perform the steps to replicate the problem.

4. When the issue occurs, trigger the sysdiagnose archive. Note the time of the event.

5. save the contents of the Console log. Please verify that the string “fetchSoftwareAddOns” appears in the console log. If this string does not appear, then the profile was either not installed properly or the device was not restarted after the install to the device.

6. Wait 5 minutes after triggering the sysdiagnose archive, then sync the device with iTunes.

7. When the sync is finished, navigate to the location of the sysdiagnose logs


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


After logging in, select the “Other” Product.


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

make sure to include the application ID

add the in app purchase identifiers which are failing

attach the console log as well as the sysdiagnose archive which you captured.

Indicate whether the problem is with the sandbox or production version of the app.

Describe what sequence of StoreKit API calls were made.

Note the time of the failure in the description.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

38663960 Has been marked dupe of 38616853

Going to settings and enabling restrictions, then disabling restrictions got sandbox InApp purchases working for me again!!

Going to settings and enabling restrictions, then disabling restrictions got sandbox InApp purchases working for me again!!

We’ve submitted bug report 38674215 Thanks

I can confirm this fixes the issue. This is really frustrating. We've submitted the app for review again and wrote the review team a note about the bug..

This only temporarily fixes it for me, it reverts back to failing after one or two purchases and have to do it again to get it working again.

Thank you for everyone who has submitted bug reports and forwarded the bug reports to me. I'm aware that we are investigating this issue.


For anyone who has not submitted a bug report, I would urge you to submit a bug report, to indicate you are affected and that the problem persists. As evidence, please open the Terminal app and ping the sandbox server. Capture the results and paste them into the bug report.


user$ ping -c 5 sandbox.itunes.apple.com


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

After logging in, select the “Other” Product.

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

make sure to include the application ID

add the in app purchase identifiers which are failing

paste the results of the ping commandline.


Please send the bug report to me at "rkubota@apple.com"


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

My bug report has been closed as dupe, so in case this is of use:


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

Has this been resolved . its been over 3 weeks since this has been broken. I am not sure how others are getting to workaround this

What restrictions are you enabling/disabling? Where are these under settings?

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!

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