Ios 如何从SKProductsRequestDelegate重新触发productsRequest()?
我的应用程序被拒绝了两次,因为IAP价格没有显示在应用程序审阅者面前。我非常喜欢这个,因为它可以在我的iPhone上正常工作 我的四个订阅将被检索并显示在tableview中:Ios 如何从SKProductsRequestDelegate重新触发productsRequest()?,ios,swift,in-app-purchase,Ios,Swift,In App Purchase,我的应用程序被拒绝了两次,因为IAP价格没有显示在应用程序审阅者面前。我非常喜欢这个,因为它可以在我的iPhone上正常工作 我的四个订阅将被检索并显示在tableview中: func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return options?.count ?? 0 } ... var options: [Subscriptio
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return options?.count ?? 0
}
...
var options: [Subscription]?
extension SubscriptionService: SKProductsRequestDelegate {
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
options = response.products.map { Subscription(product: $0) }
}
func request(_ request: SKRequest, didFailWithError error: Error) {
if request is SKProductsRequest {
print("Subscription Options Failed Loading: \(error.localizedDescription)")
}
}
}
代理通过SKProductsRequestDelegate
自动加载选项。我不明白我错过了什么。除非审查人员在离线模式下测试应用程序,并且无法访问互联网?出于安全原因,情况会是这样吗
难道我不应该从appstore加载产品productsRequest()
,并在客户端硬编码价格吗
更新:
我现在可以重复这个问题:
如果设备处于飞行模式,然后我启动应用程序,则会自然调用此方法:
func request(_ request: SKRequest, didFailWithError error: Error) {
但即使在退出飞行模式后,也不可能实现此功能
重新引发
productsRequest()
。除了当应用程序返回前台时,还有什么方法可以手动触发吗?我能看到的第一件事是,在加载产品后,您不会重新加载表视图。每次进入“存储”视图控制器时,如果应用程序前景化时要触发的options
为nil
,您可以重试产品请求,请实现appdelegate方法。在这里,您可能希望调用一个包含用于启动请求的代码的方法