StoreKit 2: currentEntitlements always returns empty on Restore...

I tried deleting the configuration file, but I ended up with an alert asking me to sign in with my sandbox ID. I did, and it returned an error: "Request Canceled". It is as if the purchase function doesn't update the currentEntitlements. This is my purchase function. Am I doing something wrong?

func purchase(_ product: Product) async throws {
         let result = try await product.purchase()

       switch result {
        case .success(let verificationResult):
            switch verificationResult {
            case .verified(let transaction):
                // Successful purchase - deliver content
                await updatePurchasedProducts()
                await transaction.finish()
                // Go back to the map
                integratePlanAhead()
            case .unverified(_, let error):
                // Purchase failed verification
                throw error
            }

        case .userCancelled:
            // User cancelled the purchase
            break

        case .pending:
            // Purchase is pending (e.g., parental approval needed)
            break

        @unknown default:
            break
        }
    }

It looks like purchases are never updated for my sandbox user... Thanks for any help :)

Try this:

   switch result {
    case .success(let verification):
        //Check whether the transaction is verified. If it isn't,
        //this function rethrows the verification error.
        let transaction = try checkVerified(verification)
        
        //The transaction is verified. Deliver content to the user.
        await updateCustomerProductStatus()
        
        //Always finish a transaction.
        await transaction.finish()
                    
        return transaction
    case .userCancelled, .pending:
        return nil
    default:
        return nil
    }
StoreKit 2: currentEntitlements always returns empty on Restore...
 
 
Q