应用内购买请求Swift TVOS

时间:2018-12-15 17:39:02

标签: swift tvos storekit ios12

我的这段代码在iOS应用中运行良好,但在TVOS Swift中却无法运行

这是我的代码

import StoreKit
SKProductsRequestDelegate, SKPaymentTransactionObserver

 let product_id: NSString = "ProductID"
 let defaults = UserDefaults.standard


  if (SKPaymentQueue.canMakePayments()) {
                    let productID:NSSet = NSSet(object: self.product_id);
                    let productsRequest:SKProductsRequest = SKProductsRequest(productIdentifiers: productID as! Set<String>);
                    productsRequest.delegate = self;
                    productsRequest.start();
                    print("Fetching Products");
                } else {
                    print("can't make purchases");
                }

但是使用此代码 productsRequest.start(),我无法致电

func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {

0 个答案:

没有答案