1

Swift アプリの IAP を実行したいのですが、コードを介して intune に接続しようとすると、xcode に資格がありません。添付ファイルを参照してください。

iTunes Connectを接続するための私のコードは次のとおりです。

func loadStoreProducts(){


    if (SKPaymentQueue.canMakePayments()){
        KVNProgress.show(withStatus: "Loading payment options")
        let productsRequest:SKProductsRequest = SKProductsRequest(productIdentifiers: Set([productID]));
        productsRequest.delegate = self;
        productsRequest.start();
    }else{
        AppDelegate.getAppDelegate().showMessage("Your Apple account doesn't allow payments, you cannot have a JustAskMe subscription.")
    }
}

func restoreTransactions(){
    SKPaymentQueue.default().restoreCompletedTransactions()
}

func buyMembership(product:SKProduct){
    let payment = SKPayment(product: product)
    SKPaymentQueue.default().add(payment);
}

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

    DispatchQueue.main.async(){
        KVNProgress.dismiss()
    }


    if (!response.products.isEmpty) {

        let  validProduct: SKProduct = response.products[0] as SKProduct

        if (validProduct.productIdentifier == self.productID) {
            print(validProduct.localizedTitle)
            print(validProduct.localizedDescription)
            print(validProduct.price)
            buyMembership(product: validProduct);
        } else {
            // got a product that wasn't the one we asked for?
            print("Invalid product found: \(validProduct.productIdentifier)")
        }
    } else {
        AppDelegate.getAppDelegate().showMessage("Problems processing your payment, please try again.")
    }
}

func request(_ request: SKRequest, didFailWithError error: Error) {

    DispatchQueue.main.async(){
        KVNProgress.dismiss()
    }
    // notify the user
    AppDelegate.getAppDelegate().showMessage("Problems processing your payment, please try again.")
    //log the issue.
    print(error.localizedDescription)

}


func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
    DispatchQueue.main.async(){
        KVNProgress.dismiss()
    }

    for transaction:AnyObject in queue.transactions
    {
        let trans : SKPaymentTransaction = transaction as! SKPaymentTransaction
        let identifier : NSString = trans.payment.productIdentifier as NSString
        print(identifier)
    }

}

func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
    DispatchQueue.main.async(){
        KVNProgress.dismiss()
    }

}

func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: Error) {
    DispatchQueue.main.async(){
        KVNProgress.dismiss()
    }
    // notify the user
    AppDelegate.getAppDelegate().showMessage("Problems loading your previous purchases, please try again.")
    //log the issue.
    print(error.localizedDescription)
}

ここに画像の説明を入力

4

2 に答える 2