Restore purchase swift 4 programmatically

时光毁灭记忆、已成空白 提交于 2019-12-11 17:05:23

问题


This problem occurs to me: Purchase a subscription through a movie with a lock. I click on the camera button. The subscription view opens. I make my purchase: I display an error message (but the purchase is still successful).

func subscribe(sub: SubscriptionType) {
DispatchQueue.main.async { let _ = MBProgressHUD.standardHud(over: self.managedView) }
FS2Recipes.subscribe(sku: sub.sku()).then { _ in
    self.subscribed()
}.catch { error in
    debugPrint("Error \(error.localizedDescription)")
    let alert = UIAlertController(title: "Ooops", message: "There was an error processing your purchase. Try again later!", preferredStyle: UIAlertControllerStyle.alert)
    alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak self] _ in
        self?.dismiss()
    }))
    self.present(alert, animated: true, completion: nil)
}.always {
    DispatchQueue.main.async { let _ = MBProgressHUD.hide(for: self.managedView, animated: true) }
}

}

Error

来源:https://stackoverflow.com/questions/55083115/restore-purchase-swift-4-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!