Storekit2: subscription is NOT EXISTANT and still append subscription!! BUG?

48 views Asked by At

I am really frustrated with storekit2, is it me or is it an Apple bug?

the subscription doesn't exist LITERALLY and the code still append a subscription to my currentSubscriptions!! (see image) enter image description here

// update the customers products
@MainActor
func updateCustomerProductStatus() async {
    var purchasedSubs: [Product] = []
    var purchasedIAP: [Product] = []
    
    //iterate through all the user's purchased products
    for await result in Transaction.currentEntitlements {
        do {
            //again check if transaction is verified
            let transaction = try checkVerified(result)
            
            //Check the `productType` of the transaction and get the corresponding product from the store.
            switch transaction.productType {
            case .consumable:
                if let iap = iaps.first(where: { $0.id == transaction.productID }) {
                    purchasedIAP.append(iap)
                
                }
            case .autoRenewable:
                if let subscription = subscriptions.first(where: { $0.id == transaction.productID }) {
                        //SUBSCRIPTION DOESN'T EXIST AND STILL GETS APPENDED!!
                        purchasedSubs.append(subscription)

                }
            default:
                break
            }
            
        } catch {
            //storekit has a transaction that fails verification, don't delvier content to the user
            print("Transaction failed verification")
        }
        
        //finally assign the purchased products
       
        self.purchasedIAPs = purchasedIAP
        self.purchasedSubscriptions = purchasedSubs
        
    }
}

maybe it's just a storekit error that only happens in xcode debug? like other stuff that doesn't work in the debug but works in prod,

help! I don't want to give 1% of my revenue to the RevenueCat!

0

There are 0 answers