- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用 SwiftyStoreKit 检查用户是否购买了产品 ID 为 com.X.X 的产品?我想使用 SwiftyStoreKit 代码来检查用户是否已经使用应用内购买系统购买了产品?我想这样做以确定我是否应该向他们展示一个功能。如何使用 Apple 的应用内购买系统检查用户是否已经购买了产品?使用 swift
最佳答案
func checkIfPurchaed () {
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: "your-shared-secret")
SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
switch result {
case .success(let receipt):
let productId = "com.app.name.productID"
// Verify the purchase of a Subscription
let purchaseResult = SwiftyStoreKit.verifySubscription(
ofType: .renewing //or .nonRenewing
productId: productId,
inReceipt: receipt)
switch purchaseResult {
case .purchased(let expiryDate, let items):
print("\(productId) is valid until \(expiryDate)\n\(items)\n")
case .expired(let expiryDate, let items):
print("\(productId) is expired since \(expiryDate)\n\(items)\n")
case .notPurchased:
print("The user has never purchased \(productId)")
}
case .error(let error):
print("Receipt verification failed: \(error)")
}
}
}
关于ios - SwiftyStoreKit 如何检查用户是否购买了产品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48024076/
我正在使用 SwiftyStoreKit在我的申请中。我还有一个自动续订订阅,可以正常购买。 自动续订订阅 已购买,当用户启动应用程序时,它会使用 verifyReceipt 验证订阅。通常在检查时,
我正在学习实现应用内购买的教程,https://www.youtube.com/watch?v=dwPFtwDJ7tc&t=1170s当我尝试编写它时,有一行代码与教程不同。 视频说把这行代码写成:
因此,我对应用程序中的自动续订订阅有一个非常基本的概念,可以解锁 PRO 功能。我还有一项非消耗性购买,它是“一次性购买订阅”,可以一次性解锁 PRO 功能。 我无法理解的是,当我调用 restore
如何使用 SwiftyStoreKit 检查用户是否购买了产品 ID 为 com.X.X 的产品?我想使用 SwiftyStoreKit 代码来检查用户是否已经使用应用内购买系统购买了产品?我想这样做
在第一个版本中,我使用了 3 个产品 ID 每月 三个月 和年度订阅 在我的新版本的应用程序中有 2 个产品 ID,这是全新的 月份 年份 所以我的问题是,对于已经使用旧产品 ID 购买订阅的老用户,
我正在将 myp 项目从 Swift 2.3 升级到 3。 来自 SwiftyStoreKit 的 Github 的示例代码: .SwiftyStoreKit.purchaseProduct("com
我想在我的标签内显示 SKProduct 商品的价格,而不是像 SwiftyStoreKit 那样显示为 alertView。 在viewDidLoad中,我试过了 coralsAppLabel.te
我是一名优秀的程序员,十分优秀!