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!!
Unfortunatelly I cannot attach an image but the susbcrioption doesn't exist in the storekit debug window but the code still append a valid subscription!
// 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
}
}