Swift - 在应用程序购买中 - 无效的产品标识符

时间:2014-11-13 21:59:36

标签: ios swift identifier storekit

In App的这个主题让人头疼。 1)我按书完成了所有事情,我得到了这个错误:

 reason: 'Invalid product identifier: (null)'

bundle id和xcode,apple developer和itunes connect都是一样的 ID是100%正确  这是我使用的方法:

触发所有内容的按钮:

let payment : SKPayment = SKPayment(product: self.product)
        SKPaymentQueue.defaultQueue().addPayment(payment)

其他方法::

 func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) {

        var productsarray : Array = response.products
        if productsarray.count != 0 {

            product = productsarray[0] as SKProduct


        }
        else {

            println("no products found")

        }
        productsarray = response.invalidProductIdentifiers

    }

    func paymentQueue(queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) {
        for transaction in transactions
        {
            if transaction.transactionState == SKPaymentTransactionState.Purchased {
                unlockpurchaes()
                SKPaymentQueue.defaultQueue().finishTransaction(transaction as SKPaymentTransaction)
            }
            else if transaction.transactionState == SKPaymentTransactionState.Failed {
                println("transaction failed")
            }


        }
    }

    func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue!) {
        unlockpurchaes()
    }

查看已加载:

  self.productid = "ExtraHeartbeat"

        if SKPaymentQueue.canMakePayments() {

            let request : SKProductsRequest = SKProductsRequest(productIdentifiers: NSSet(objects: self.productid))
            request.delegate = self
            request.start()

        }
        else {

            println("cannot buy")


        }

属性:

 var product : SKProduct!
    var productid :  String!

1 个答案:

答案 0 :(得分:0)

您是否已完成法律,银行和联系信息?因为我做了这个伎俩。