IAP正在运行,但当我在视图之间移动并返回到IAP VC时,应用程序崩溃了 SKPaymentQueue.defaultQueue().addPayment(payment)
ERROR: EXC_BAD_ACCESS
我找到了解决方案,你需要清理SKPaymentQueue
一下viewWillDisappear
更新Swift 4.2
override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) SKPaymentQueue.default().remove(self) }
斯威夫特2.3
override func viewWillDisappear(animated: Bool) { super.viewWillDisappear(animated: animated) SKPaymentQueue.defaultQueue().removeTransactionObserver(self) }