“Cannot connect to iTunes Store” in-app purchases

前端 未结 17 2347
鱼传尺愫
鱼传尺愫 2020-12-01 06:13

I am having problems testing my in-app purchases. I get back valid product identifiers, but upon purchase I receive the dreaded \"Cannot connect to iTunes Store\". Interesti

相关标签:
17条回答
  • 2020-12-01 06:29

    I fixed mine! If you are getting Error Domain=SKErrorDomain Code=2 "Cannot connect to iTunes Store" error, make sure you insert SKPaymentQueue.default().finishTransaction(transaction). It worked for me after I added SKPaymentQueue.default().finishTransaction(trans) in the following:

    func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        for trans in transactions{
            if trans.transactionState == .purchased {
                print("Successful.")
                SKPaymentQueue.default().finishTransaction(trans)
            } else if trans.transactionState == .failed {
                print("failed!")
                print(trans.error)
                SKPaymentQueue.default().finishTransaction(trans)
            }
        }
    

    Found in Apple developer website, here

    0 讨论(0)
  • 2020-12-01 06:30

    For newcomers, make sure your in-app purchasing product's status is Ready to Submit, with no "missing metadata". In my case, what was missing was the localization of the subscription's group.

    0 讨论(0)
  • 2020-12-01 06:31

    Make sure you have signed out of any production iTunes accounts on the device.

    I was getting this error on my test phone which was logged in with my actual iTunes account. You cannot test apps using your production iTunes account, hence the error. I just wish Apple provided a better error so as to avoid this guesswork...

    0 讨论(0)
  • 2020-12-01 06:31

    Make sure the system status is ready https://www.apple.com/support/systemstatus/

    I have an Iphone, Restart it worked for me

    0 讨论(0)
  • 2020-12-01 06:31

    I had to go to Settings > iTunes & App Stores, then scroll to the bottom to the "Sandbox Account" field and Sign out from there. Now it is working!!!

    0 讨论(0)
  • 2020-12-01 06:34

    This problem remains persistent in 2016. Incredible. Here was my solution:

    Add a build number. Target > General > Identities > Build.

    0 讨论(0)
提交回复
热议问题