Issues with Testing Introductory Offers in the Sandbox

I'm running into some baffling issues related to testing Introductory Offers in the Sandbox environment using Sandbox Tester accounts. I've created an Introductory Offer for a single country (Armenia) to avoid presenting the offer for other countries in the live version of my app. I've also created a new Sandbox Tester with App Store Country set to Armenia, installed a test version of my app via XCode, and logged in with my Armenian Sandbox Account via Settings -> iTunes & App Store -> Sandbox Account. My goal is to test that the introductory offer is only presented if the logged-in user qualifies for it.


After loading product info via SKProductsRequest (which I do on app launch as well as a few other places), I expected introductoryPrice to be set for the related subscription product, but it was nil. However, after tapping my "Restore Purchases" button and reloading products, it was set! Then, I took an action that I knew would re-request products, and the field was again nil. At this point, I suspected that StoreKit was caching SKProductsResponses, so I put my device in airplane mode, disabled WiFi, and took another action to reload products. Lo and behold, I received a response via productsRequest:didReceiveResponse, even though I had no network connection. Certainly smells like caching...


Something that might be relevant: after restoring purchases, I always validate the receipt locally to determine the current state of the user's subscription. If the receipt is not available (which it often initially isn't when installing via XCode and/or using the Sandbox), I request it via SKReceiptRefreshRequest. Does the receipt impact how StoreKit fetches product information?


Another similar issue: if I log out of one Sandbox Account and into another located in a different country with different currency, the locale set on products is not correct when I relaunch my app, resulting in my store displaying the wrong currency. I would expect StoreKit to immediately return updated SKProduct records in this situation, but again, it doesn't until I run restore purchase/receipt validation.


To summarize, here are my questions:

- Does StoreKit cache SKProductsResponses? Is the behavior the same in the Sandbox vs. Production? If it does, is there a way to bypass the cache?

- When (if ever) does the system load a Sandbox Account's receipt?

- Does the receipt affect SKProductsRequest in any way?

- How should an app that presents information from SKProducts handle a user logging out of one Apple ID account an into another? An edge case, I know, but it's certainly possible...

This is an odd sounding issue which I've not heard of before. This is clearly a bug report issue. Please follow these instructions to submit the bug report.


The first thing is to collect a sysdiagnose trace with the StoreKit profile installed.

Here are the instructions to install the StoreKit profile

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/> using Safari on the device you will use to replicate the problem with.

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

For iOS 12.2 or later, you will open the Settings app -> General -> Profiles & Device Management -> iTunes and App Stores Diagnostic logging -> press Install


To learn how to capture the sysdiagnose trace - find the "iAP for iOS" profile and click on the "Instructions" item. Start with step 3. of the instructions listed under "iAP Accessory Logs"


To submit a bug report, please use the Apple Developer Feedback web page -

<https://feedbackassistant.apple.com/>.


Enter the “Feedback Assistant” page and login

Click on the Compose icon to start a new bug report


Start by clicking on the appropriate OS button - “iOS and iPadOS”

1. In the “Descriptive Title” field, enter a descriptive Title

2. In the “Problem Area” field select “StoreKit”

3. In the “Type of Feedback” select “Incorrect / Unexpected Behavior”

4. In the “Describe the Issue” section enter the following

- application ID (and In-App Purchase identifiers if appropriate)

- sandbox environment

- the instructions for finding the “Buy” button to purchase the In-App Purchase item.

(if the app is not in English, please provide screenshots)

- additional details as provided in your description such as targeting the Armenian iTunes App Store

- the instructions for replicating the issue as you've described above.

5. Submit the bug report, then prepare to submit a TestFlight build. Let me know the feedbackassistant number FBxxxxxxxx by sending me a note to my email - rkubota@apple.com.

I will look up the bug report number and provide it to you. You will include the bug report number in the test instructions to include with the TestFlight submission to “apps_test@icloud.com”.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

@gilby, Could you solve this problem? Since 1 year, SKProductsResponse is still caching the result and I have to clean build folder, delete derived data and wait 10 minutes each time I want to test SKProductsRequest. It's just a nightmare.

@rich, Do you know any new solution for that?
Issues with Testing Introductory Offers in the Sandbox
 
 
Q