Swift - In App Purchase - Invalid product identifier

1.1k Views Asked by At

This subject of In App purchase make big headache. 1) i did everything by the book , and im getting this error :

 reason: 'Invalid product identifier: (null)'

The bundle id and the xcode, apple developer and itunes connect are all the same the id is 100% correct here is the methods i used :

The button that trigger everything :

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

Other methods ::

 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()
    }

View Did load :

  self.productid = "ExtraHeartbeat"

        if SKPaymentQueue.canMakePayments() {

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

        }
        else {

            println("cannot buy")


        }

Properties :

 var product : SKProduct!
    var productid :  String!
1

There are 1 best solutions below

1
On

Have you completed the legal, bank and contact information? Cause for me that did the trick.