SwiftyStoreKit
SwiftyStoreKit copied to clipboard
Call to restore purchase on macOS 11.2, return "Nothing to Restore"
Bug Report
Call Restore Purchase on macOS 11.2, return "Nothing to Restore", and then receive a callback to restore purchase in the completion function. Actually, you have already purchased. The sample code and terminal print information are as follows:
func applicationDidFinishLaunching(_ aNotification: Notification) {
SwiftyStoreKit.completeTransactions(atomically: true) { purchases in
print("completeTransactions:", purchases)
for purchase in purchases {
switch purchase.transaction.transactionState {
case .purchased, .restored:
if purchase.needsFinishTransaction {
// Deliver content from server, then:
SwiftyStoreKit.finishTransaction(purchase.transaction)
}
case .failed, .purchasing, .deferred:
break // do nothing
}
}
}
SwiftyStoreKit.restorePurchases(atomically: true) { results in
if results.restoreFailedPurchases.count > 0 {
print("Restore Failed: \(results.restoreFailedPurchases)")
}
else if results.restoredPurchases.count > 0 {
print("Restore Success: \(results.restoredPurchases)")
}
else {
print("Nothing to Restore")
}
}
}
Terminal Response:
Nothing to Restore
Finishing transaction for payment "com.app.lifetime" with state: restored
completeTransactions: [SwiftyStoreKit.Purchase(productId: "com.app.lifetime", quantity: 1, transaction: productId: com.app.lifetime, transactionId: 1000000772090167, state: restored, date: Optional(2021-02-01 07:31:12 +0000), originalTransaction: Optional(productId: com.app.lifetime, transactionId: 1000000769635443, state: purchased, date: Optional(2021-01-26 02:57:38 +0000)), needsFinishTransaction: false)]
To Reproduce
Expected behavior A clear and concise description of what you expected to happen.
Platform Information
- OS: macOS 11.1
- Purchase Type: [non-consumable, auto-renewable subscription]
- Environment: [sandbox, production]
- SwiftyStoreKit version: [0.16.1]
Potentially Related Issues
The same error, macOS 11.2.3.