2

I haven't been able to determine a pattern for when it will show and when it won't. The purchases are all successful though. Behind the scenes, the StoreKit2 returns data showing they've made the purchase/upgrade and apple sends my dev server the transaction notifications via the AppStore Server API.

Any idea why the "You're All Set" alert isn't being shown?

func purchase(_ product: Product, appaccounttoken: UUID) async throws -> Transaction? {
    // Begin purchasing the `Product` the user selects.
    let result = try await product.purchase(options: [.appAccountToken(appaccounttoken)])

    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
    }
}

which is called by ...

if let transaction = try await self.purchase(product, appaccounttoken: uuid) {
    return transaction.id
}

which is called by ...

if let transactionid = try await Store.store.subscribe(id: productid, owner: self.owner) {
    print("transaction: \(transactionid)")

    self.presentingViewController?.dismiss(animated: true)

}

In my testing, the "You're All Set" alert is shown and then AFTER I tap the "OK" button on it, the code returns to the try await Store.store.subscribe() call and then prints my transaction id and dismisses the view controller.

But sometimes, and without any pattern I can discern, the transaction completes, the transaction id is returned from my try await Store.store.subscribe() call and my view controller is dismissed... but the "You're All Set" alert never pops up.

Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229

0 Answers0