Testing Multiple In App Purchases in Unpublished App

I am a new app developer. I successfully tested my first in app purchase to remove ads. I then tried to include a consumable, but every time the app reads the available list, I get an error for that one. I can't seem to find a solution somewhere and wonder if this is a problem that might happen with testing an unpublished app. Here is the relevant snippet of code as well as a screenshot of my In App Purchase section of the App Store Connect.

Task { do { let storeProducts = try await Product.products(for: ["removeAds1", "cactusCoin5"]) DispatchQueue.main.async { self.products = storeProducts self.printProducts() } } catch { print("Failed to fetch products: \(error.localizedDescription)") } }

Thank you for any assistance.

Answered by mwtaylor in 797251022

Update: the test seems to work when using the TestFlight version of the app, but not when just using a regular build on a simulator or even a physical device. Sort of strange. That should probably be documented somewhere so others will know the answer.

Accepted Answer

Update: the test seems to work when using the TestFlight version of the app, but not when just using a regular build on a simulator or even a physical device. Sort of strange. That should probably be documented somewhere so others will know the answer.

Is StoreKit Testing in Xcode enabled in your Xcode project? If enabled, StoreKit uses the local environment (values defined in your StoreKit configuration file) during testing. If disabled, StoreKit uses in-app purchased configured for your app in App Store Connect during testing.

Thank you. Actually, I did have it enabled and I had a StoreKit file that had both items. When I switched it off (selecting "none), everything showed up. I don't know. But the process I have is good enough to let me see everything I need.

I just figured it out. Silly typo. I had misspelled the product id in the StoreConfig file. But you were a big help in pointing me back to that setting. Thank you!

Testing Multiple In App Purchases in Unpublished App
 
 
Q