首页 > 解决方案 > 以编程方式恢复购买 swift 4

问题描述

我遇到了这个问题:通过带锁的电影购买订阅。我点击相机按钮。订阅视图打开。我进行购买:我显示一条错误消息(但购买仍然成功)。

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) }
}

}

错误

标签: iosswiftin-app-purchaserestore

解决方案


推荐阅读