【发布时间】:2016-01-31 14:55:29
【问题描述】:
我正在尝试制作一个简单的 IAP 来删除我应用的所有广告。
当我购买 IAP 时它可以工作,但是当我尝试使用清除沙盒帐户(从未购买过 IAP)restore 购买时,它可以工作。
因此,restorePurchases() 始终有效,即使用户之前没有购买 IAP。
有我的代码: 当用户选择恢复按钮时,我执行此方法:
func restaureIAP() {
PKNotification.toast("Chargement en cours...")
MKStoreKit.sharedKit().restorePurchases()
}
我还添加了观察者:
// Product restaure
NSNotificationCenter.defaultCenter().addObserverForName(kMKStoreKitRestoredPurchasesNotification,
object: nil, queue: NSOperationQueue.mainQueue()) { (note) -> Void in
PKNotification.success("Restauré !")
print ("Succes restaure: \(note.object)")
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "isPurchase")
}
NSNotificationCenter.defaultCenter().addObserverForName(kMKStoreKitRestoringPurchasesFailedNotification,
object: nil, queue: NSOperationQueue.mainQueue()) { (note) -> Void in
PKNotification.failed("Erreur")
print ("Failed restaure: \(note.object)")
}
这个应用程序在AppStore上可用,并且有同样的问题:购买IAP工作但restore购买总是成功。
你有什么想法吗?
【问题讨论】:
-
你的 IAP 产品是什么类型的?
-
transactionState属性的值是多少? -
这是非消耗性 IPA
-
你有没有想过这个问题?我在使用自动续订订阅产品时遇到了同样的问题。
标签: ios swift in-app-purchase mkstorekit