我正在尝试使用新的 StoreKit 2 API 测试我的 macOS 应用程序的 IAP。
我创建了一个.storekit
文件,并在我的方案中分配了它运行 > 选项 > StoreKit 配置。
检索测试产品没有问题:
let identifiers = Set(["myProductId"])
let products = try await Product.products(for: identifiers)
但是当我想模拟购买时,什么也没有发生。它卡住了,从不打印结果。
func purchase(product: Product) async throws {
print("Purchasing \(product.id) ...")
let result = try await product.purchase()
print(result)
}
我目前使用的是 macOS Monterey Beta 8 和 Xcode 13 beta 5。