Issues with StoreKit

I am a long time developer but have never incorporated an IAP into any of my work so this is very new to me. So to save time I have used some AI for coding, but the code is having an issue and I'm not sure whether it is in the code or in Xcode.

Xcode 27 on macOS 27.0.1 for iOS 27.0.1. IAP is to unlock full access after a 14-day trial.

DESCRIPTION OF PROBLEM

In local Xcode StoreKit testing, Product.purchase() returns .pending (as expected, since "Ask to Buy" is enabled), and Xcode’s transaction manager continues to show “Pending Approval.” After closing and reopening the app’s purchase sheet, the same transaction appears as verified and non-revoked in Transaction.currentEntitlements and is delivered through Transaction.updates, giving full access to the app. This reproduces in a standalone UIKit test app (linked below).

The source file in question is AppAccessManager.swift. The relevant functions are:

  • AppAccessManager.purchaseProduct()

Calls product.purchase(). Handles .pending by recording a request reminder and displaying feedback.

  • AppAccessWindowViewController.viewDidLoad()

Runs when the purchase-options sheet is opened. Calls manager.start() followed by manager.refreshAccessState(). This is the sheet-opening path associated with the unexpected transaction delivery.

  • AppAccessManager.refreshAccessState()

Iterates Transaction.currentEntitlements. A transaction still labeled “Pending Approval” in Xcode is returned here as verified and nonrevoked.

  • AppAccessManager.startListeningForTransactionUpdates() and handleTransactionUpdate(_:)

The same pending transaction is also delivered through this sequence as verified and nonrevoked. The handler applies access before calling transaction.finish().

  • AppAccessManager.applyVerifiedPurchase(_:)

Applies verified transactions received from successful purchases or the listener.

STEPS TO REPRODUCE

https://avliscoding.com/storekittest.zip

  • Launch app
  • Select "Open Purchase Sheet"
  • Start trial
  • Quit app, enable "Ask to Buy" in StoreKit file configuration settings
  • Restart app.
  • Select Purchase (will give a pending message in response)
  • Close sheet
  • Reopen sheet

The app now believes it has made that purchase even though the purchase is still "Pending" in Xcode.

Issues with StoreKit
 
 
Q