问题描述
我试图在购买成功后关闭警报控制器,然后人们可以进入解锁以阅读下一个故事板中的故事。
它不断弹出说“你的购买准备好买了它”并且不会让我跳到下一个故事板来阅读它。
我使用 UITableViewController 所以这里是代码结果;
func tableView(_ tableView: UITableView,didSelectRowAt indexPath: IndexPath) {
// MARK: Countdown Tracks
let getDate = Calendar.current.date(from: dateArray[indexPath.row])?.timeIntervalSince1970
let curDate = Date().timeIntervalSince1970
let dateDifference = getDate! - curDate
if dateDifference <= 0 {
sliceData.removeAll()
sliceData.append((epsoide: indexPath.row + 1,slideNum: sliceNum[indexPath.row]))
UITableViewEposides.deselectRow(at: indexPath,animated: true)
let vc = slideList()
vc.title = "Episode \(sliceData[0].epsoide)"
navigationController?.pushViewController(vc,animated: true)
} else {
let alertController = UIAlertController(title: "Early Read Pass",message: "this is test",preferredStyle: .alert)
let PaymentAction = UIAlertAction(title: "Puchase $0.99 to unlock Epsoide \(indexPath.row + 1)",style: UIAlertAction.Style.default,handler: {
(action) in
switch indexPath.row {
case 3:
IAPService.shared.purchase(product: .epsiode4non_consumable)
case 4:
IAPService.shared.purchase(product: .epsiode5non_consumable)
case 5:
IAPService.shared.purchase(product: .epsiode6non_consumable)
case 6:
IAPService.shared.purchase(product: .epsiode7non_consumable)
case 7:
IAPService.shared.purchase(product: .epsiode8non_consumable)
case 8:
IAPService.shared.purchase(product: .epsiode9non_consumable)
case 9:
IAPService.shared.purchase(product: .epsiode10non_consumable)
default:
break
}
})
let cancelAction = UIAlertAction(title: "Cancel",style: UIAlertAction.Style.cancel) {
UIAlertAction in
print("Cancel pressed")
}
// Add the actions
alertController.addAction(PaymentAction)
alertController.addAction(cancelAction)
// Present the controller
self.present(alertController,animated: true,completion: nil)
}
}
有人知道如何解决这些问题吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)