Hi,
Some good news! I finally decided to try another route to get around this. The app review team finally approved my app. I still don't know what happened to the ProductView. The handling for transaction could go wrong but the purchase flow should be triggered correctly.
Simply replace the product view with some custom code
if store.activeTransactions.isEmpty {
ForEach(store.products, id: \.id) { product in
Button {
Task {
try await store.purchase(product)
}
} label: {
VStack {
Text(verbatim: product.displayName)
.font(.headline)
Text(verbatim: product.displayPrice)
}
}
.buttonStyle(.borderedProminent)
}
And in the Store class
func purchase(_ product: Product) async throws {
let result = try await product.purchase()
switch result {
case .success(let verificationResult):
if let transaction = try? verificationResult.payloadValue {
activeTransactions.insert(transaction)
await transaction.finish()
}
case .userCancelled:
break
case .pending:
break
@unknown default:
break
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: