Question

Can't fetch one product in offering

  • 5 December 2022
  • 1 reply
  • 240 views

Badge +4

Hello,

I have a bug where my Yearly package is missing in Release builds (but works in Debug and App Store, fails in TestFlight and App Review). My Lifetime and Monthly packages are returned file, and my Monthly package is part of a subscription group with the yearly

 

I have checked:

  • All IAPs are Approved
  • All agreements are signed and active
  • I am not using a StoreKit configuration file
  • I have read the Why are offerings or products empty? help article, and verified everything.

App Review has returned both Error 2 and Error 9

 

I will copy and paste the identifiers from both App Store Connect and RevenueCat here:

Lifetime Package:

ASC: com.willbishop.Simmer.simmeprolifetime

RevenueCat: com.willbishop.Simmer.simmeprolifetime

 

Monthly:

ASC: com.willbishop.Simmer.simmerpromonthly

RevenueCat: com.willbishop.Simmer.simmerpromonthly

 

Yearly 

ASC: com.willbishop.Simmer.simmerproyearly

RevenueCat: com.willbishop.Simmer.simmerproyearly

 

They are all a part of an offering called “Pestle Pro”, and are fetched like so:

 

func getAvailableProducts(completion: (() -> Void)? = nil) {

    self.getCurrentOffering { offering in

    self.currentOffering = offering

    if let packages = offering?.availablePackages {

        self.allPackages = packages

        for package in packages {

            switch package.packageType {

                case .lifetime:

                    self.lifetimePackage = package

                case .annual:

                    self.yearlyPackage = package

                case .monthly:

                    self.monthlyPackage = package

                default:

                    break

                }

            }

            self.checkTrialEligibilityStatus(packages: packages)

        }

        completion?()

    }

}

 

Lastly, this only occurs with StoreKit 2, if I explicitly disable StoreKit 2, it works, but it shows the incorrect price for items, and I get log complaints telling me to turn on StoreKit 2

 

2022-12-05 21:26:05.110577+1030 Pestle[8581:2021937] [Purchases] - WARN: 🍎‼️ There is a problem with the SKPaymentTransaction missing a transaction date - this is an issue with the App Store. Unix Epoch will be used instead.

2022-12-05 21:26:05.110654+1030 Pestle[8581:2021937] [Purchases] - WARN: 🍎‼️ There is a problem with the SKPaymentTransaction missing a transaction identifier - this is an issue with the App Store.Transactions in the backend and in webhooks are unaffected and will have the correct identifier. This is a bug in StoreKit 1. To prevent running into this issue on devices running iOS 15+, watchOS 8+, macOS 12+, and tvOS 15+, you can set `usesStoreKit2IfAvailable` to true when calling `configure`.

 

The log output looks like this:

2022-12-05 21:10:46.460775+1030 Pestle[8516:2011969] [Purchases] - DEBUG: 👤 Identifying App User ID

2022-12-05 21:10:46.462212+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ Debug logging enabled

2022-12-05 21:10:46.462231+1030 Pestle[8516:2011969] [Purchases] - INFO: ℹ️ StoreKit 2 support enabled

2022-12-05 21:10:46.462242+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ SDK Version - 4.10.2

2022-12-05 21:10:46.462253+1030 Pestle[8516:2011969] [Purchases] - DEBUG: 👤 Initial App User ID set

2022-12-05 21:10:46.512756+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ Delegate set

2022-12-05 21:10:46.513549+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ No cached Offerings, fetching from network

2022-12-05 21:10:46.514694+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ Vending CustomerInfo from cache.

2022-12-05 21:10:46.775079+1030 Pestle[8516:2012248] [Purchases] - WARN: ⚠️ The appUserID passed to logIn is the same as the one already cached. No action will be taken.

2022-12-05 21:10:46.776594+1030 Pestle[8516:2012248] [Purchases] - DEBUG: ℹ️ Vending CustomerInfo from cache.

2022-12-05 21:10:46.787904+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ applicationDidBecomeActive

2022-12-05 21:10:46.788588+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ Offerings cache is stale, updating caches

2022-12-05 21:10:46.791307+1030 Pestle[8516:2011969] [Purchases] - DEBUG: ℹ️ Vending CustomerInfo from cache.

2022-12-05 21:10:51.120348+1030 Pestle[8516:2012262] [Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Started

2022-12-05 21:10:51.120783+1030 Pestle[8516:2012262] [Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request GET subscribers/rMrOz…/offerings

2022-12-05 21:10:51.123796+1030 Pestle[8516:2012262] [Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/rMrOz…/offerings

2022-12-05 21:10:52.747536+1030 Pestle[8516:2012257] [Purchases] - DEBUG: ℹ️ API request completed: GET /v1/subscribers/rMrOz…/offerings 304

2022-12-05 21:10:52.749001+1030 Pestle[8516:2012257] [Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Finished

2022-12-05 21:10:52.749048+1030 Pestle[8516:2012257] [Purchases] - DEBUG: ℹ️ Serial request done: GET subscribers/rMrOz…/offerings, 0 requests left in the queue

2022-12-05 21:10:52.749235+1030 Pestle[8516:2012262] [Purchases] - DEBUG: ℹ️ No existing products cached, starting store products request for: ["com.willbishop.Simmer.simmerproyearly", "com.willbishop.Simmer.simmeprolifetime", "com.willbishop.Simmer.simmerpromonthly"]

2022-12-05 21:10:52.749363+1030 Pestle[8516:2012250] [Purchases] - DEBUG: ℹ️ No existing products cached, starting store products request for: ["com.willbishop.Simmer.simmeprolifetime", "com.willbishop.Simmer.simmerpromonthly", "com.willbishop.Simmer.simmerproyearly"]

2022-12-05 21:10:52.749526+1030 Pestle[8516:2012262] [Purchases] - DEBUG: ℹ️ No existing products cached, starting store products request for: ["com.willbishop.Simmer.simmerpromonthly", "com.willbishop.Simmer.simmeprolifetime", "com.willbishop.Simmer.simmerproyearly"]

2022-12-05 21:10:56.276973+1030 Pestle[8516:2012250] [Default] [StoreKit:c529] Failed to decode Product: countMismatch(for: [StoreKit.Product.Key.attributes, StoreKit.Product.Key.offers, StoreKit.Product.Key.discounts], expected: Range(0..<2), actual: 2)

2022-12-05 21:10:56.277080+1030 Pestle[8516:2012250] [Purchases] - DEBUG: 😻 Store products request request received response

2022-12-05 21:10:56.277084+1030 Pestle[8516:2012249] [Default] [StoreKit:5e76] Failed to decode Product: countMismatch(for: [StoreKit.Product.Key.attributes, StoreKit.Product.Key.offers, StoreKit.Product.Key.discounts], expected: Range(0..<2), actual: 2)

2022-12-05 21:10:56.277201+1030 Pestle[8516:2012250] [Purchases] - DEBUG: ℹ️ Store products request finished

2022-12-05 21:10:56.277252+1030 Pestle[8516:2012249] [Purchases] - DEBUG: 😻 Store products request request received response

2022-12-05 21:10:56.277312+1030 Pestle[8516:2012249] [Purchases] - DEBUG: ℹ️ Store products request finished

+1030 Pestle[8516:2012250] [Purchases] - WARN: 🍎‼️ Could not find SKProduct for ["com.willbishop.Simmer.simmerproyearly"]

2022-12-05 21:10:56.277948+1030 Pestle[8516:2012249] [Purchases] - WARN: 🍎‼️ Could not find SKProduct for ["com.willbishop.Simmer.simmerproyearly"]

2022-12-05 21:10:56.278528+1030 Pestle[8516:2012249] [Purchases] - DEBUG: ℹ️ Skipping products request because products were already cached. products: ["com.willbishop.Simmer.simmerpromonthly", "com.willbishop.Simmer.simmeprolifetime"]

2022-12-05 21:10:56.278584+1030 Pestle[8516:2012249] [Purchases] - DEBUG: ℹ️ Skipping products request because products were already cached. products: ["com.willbishop.Simmer.simmerpromonthly", "com.willbishop.Simmer.simmeprolifetime"]

2022-12-05 21:10:56.281358+1030 Pestle[8516:2012249] [Default] [StoreKit:e538] Failed to decode Product: countMismatch(for: [StoreKit.Product.Key.attributes, StoreKit.Product.Key.offers, StoreKit.Product.Key.discounts], expected: Range(0..<2), actual: 2)

2022-12-05 21:10:56.281409+1030 Pestle[8516:2012249] [Purchases] - DEBUG: 😻 Store products request request received response

2022-12-05 21:10:56.281463+1030 Pestle[8516:2012249] [Purchases] - DEBUG: ℹ️ Store products request finished

2022-12-05 21:10:56.281832+1030 Pestle[8516:2012249] [Purchases] - WARN: 🍎‼️ Could not find SKProduct for ["com.willbishop.Simmer.simmerproyearly"]


1 reply

Userlevel 3
Badge +5

Hey, @WillBishop!

This this is why its not showing up 👇

2022-12-05 21:10:56.276973+1030 Pestle[8516:2012250] [Default] [StoreKit:c529] Failed to decode Product: countMismatch(for: [StoreKit.Product.Key.attributes, StoreKit.Product.Key.offers, StoreKit.Product.Key.discounts], expected: Range(0..<2), actual: 2)

This has been seen before it this is an internal error from StoreKit. The StoreKit API is returning multiple discounts (for unknown reasons) and StoreKit 2 doesn’t know how to handle that in the decoder. So this is breaking before it even gets to our parsing layer.

Your options here are:

  1. File a radar 😉 
  2. Try to reconfigure your yearly subscription’s discounts / offers to see if you can fix whatever is broken from whatever Apple is trying to return
  3. Create a new annual subscription that hopefully won’t become broken (same price, same entitlements, but just a different identifier)
  4. Keep using StoreKit 1 until fixed

Hopefully this helps!

Reply