IOS - In-App Purchase - Invalid Product ID

I am trying to integrate In-App purchases into my project. I used a third party library SwiftyStoreKit

like IAP helper.

I am trying to get information about my In-App products but I always get the answer that Invalid Product Identifiers

All my agreements are in Effect (Paid and Free). In addition, the status of My In-App Product is displayed Waiting for Upload

. My app hasn't been released yet, so I'm testing it in Sandbox mode.

Following in my code:

import UIKit
import StoreKit
import SwiftyStoreKit

override func viewDidLoad() {
    super.viewDidLoad()
}

override func viewDidAppear(_ _animated: Bool) {
    super.viewDidAppear(_animated)

    if dataModel.lists.count >= 2 {
        getInfo()
    }
}

func getInfo() {

    NetworkActivityIndicatorManager.NetworkOperationStarted()

    SwiftyStoreKit.retrieveProductsInfo([productIdentifier], completion: { result in

        NetworkActivityIndicatorManager.networkOperationFinished()

        self.showAlert(alert: self.alertForProductRetrievalInfo(result: result))

    })
}

      

+3


source to share


3 answers


Check it out productIdentifier

! It should be the same as in iTunes Connect. For example, "com.myapp.myPurchase"



+2


source


I had the same error and running this code in the app delegate seemed to solve my problem because adding the app browser at startup ensures that it persists across all app launches, allowing your app to receive all queue notifications payments,



func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
	// see notes below for the meaning of Atomic / Non-Atomic
	SwiftyStoreKit.completeTransactions(atomically: true) { purchases in
	    for purchase in purchases {
	        switch purchase.transaction.transactionState {
	        case .purchased, .restored:
	            if purchase.needsFinishTransaction {
	                // Deliver content from server, then:
	                SwiftyStoreKit.finishTransaction(purchase.transaction)
	            }
	            // Unlock content
	        case .failed, .purchasing, .deferred:
	            break // do nothing
	        }
	    }
	}
    return true
}
      

Run codeHide result


+2


source


Here's what worked for me:

I was confusing the link title (left) with the product ID (right)

So make sure your code uses the iTunes Connect Product ID.

enter image description here

0


source







All Articles