虽然实际设备上一切都运行良好,但我想知道为什么在 iOS 13 beta 5 模拟器上代理从未被调用过?
我在互联网上搜索答案,但没有找到任何信息。
我按照以下方式实现了协议的3个函数:
public class StoreKit {
var request: SKProductsRequest? = nil // Keep a strong reference
public func fetchProducts() {
print("\(#function): start fetching products")
let r = SKProductsRequest(productIdentifiers: productIDs)
request = r
r.delegate = self
r.start()
}
}
// MARK: - Get the requested products
extension StoreKit: SKProductsRequestDelegate {
/// Products are received
public func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
print("\(#function): did receive")
}
/// Unable to received the products
public func request(_ request: SKRequest, didFailWithError error: Error) {
print("\(#function): Error for request: \(error.localizedDescription)")
}
public func requestDidFinish(_ request: SKRequest) {
print("\(#function): did finish")
}
}