SKPayment / SKPaymentQueue: Cannot connect to iTunes Store - ios

I am building an App with IAP (auto-renewal subscription). The workflow seems to work fine, IPA are created for sure (in iTunes connect), sandbox user also logged in. The IAP product ID is also correct but I get the error (from SKPaymentTransaction):
Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store"
Before that error I get the purchase screens where the price, the duration of the subscription and the name of the subscription is displayed. So the connection and the product ID is correct.
I am logged in with sandbox user: The screens displays [Environment: Sandbox].
I am using a real device (iPhone 7 and iPhone 5). The error occurs on both devices and on simulator (for sure on simulator?).
Any ideas?

I forgot to add localized title and description in iTunes connect. After that the IAP worked like a charm. *doh

Related

How do I test In-App Purchase in iOS 12 using sandbox account?

I am no longer able to test In-App Purchases with Simulator for iOS 12. I didn't have this problem before.
The instructions say for me to log out of iTunes and App Store in Settings, and when I test the In-App Purchase, iOS would ask me for an Apple ID. I have done that, but iOS never asks for an Apple ID. Instead I get an error object in my code that says "Cannot connect to iTunes Store". (It doesn't terminate the app. I was able to successfully print the description of the error object in the debug window.)
When I try to put my sandbox account in the iTunes and App Store account setting, I get a message that says, "There was a problem connecting to the server."
You can display IAP products on both the iOS simulator as well as physical iOS devices, but to test buying or restoring purchases you've always needed a physical device.
On iOS 12, you can set a default sandbox user in Settings -> Your Account -> iTunes & App Store -> Sandbox Account. This can help out with the sign in prompts and save your phone from having to change accounts repeatedly.

iOS IAP Cannot connect to iTunes Store

I am testing my app in Xcode . witch means it is not officially up loaded to the appstore. so I can't test the real IAP right? I can only test the sandbox IAP before it officially online in APP store,right?
because when I use the real app id to test the IAP. it always give me error like:
_error NSError * domain: #"SKErrorDomain" - code:
#"Cannot connect to iTunes Store"
I have checked every thing, all fine. and the sandbox test was also worked fine. so the only reason of the error is the app are not officially online in apptore , am I right?
IAP can be tested only in sandbox mode with sandbox(test) user account in device.
If you are testing IAP in a sandbox mode with real iTunes apple account in the device, then the error Cannot Connect to iTunes Store is shown.

IAP purchase failed on device, but success on simulator

On iPhone simulator, I could go through and successfully finished IAP.
However, on my device, It would return at switch-case "SKPaymentTransactionStateFailed" and failed to purchase. Even I deleted the app and tried again, it still does not work. The error msg(transaction.error.localizedDescription) is: "Cannot connect to iTunes Store"
How to fix this issue?
Probably you are logged in to a production App Store account, and that prevents your app from completing an IAP from the sandbox environment.
You have to logout of your account. Go to your device Settings -> iTunes & App Stores, tap your ID and logout. Then launch your App through Xcode. When you perform an IAP, the sandbox App Store login window should come up. You can login there with any Test User previously created on iTunes Connect.
It is a temporary problem with Apple servers. Recently there were various problems with Game Center (often returning error 404) and In-App Purchases returning "Cannot connect to iTunes Store" and sometimes even proceeding with the transaction afterwards. Try it multiple times, it will work (if you have your code right of course).

ios - in-app purchase error code 3 "Cannot connect to iTunes Store"

I followed apple's guide to implement in-app purchases and when i try to purchase something i get error code 3 and the description Cannot connect to iTunes Store.
I tried to dump the network from the phone and it appears that the phone connects correctly to the sandbox. I also tried adding a new user and i signed out of the store.
I don't even get the screen to enter my test user... just the error above.
help
I had to add my bank account and tax info in itunes connect.
That solved the problem.

iPad In App Purchase fails with SKErrorPaymentCancelled and "Cannot connect to iTunes Store" [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
iPhone storekit sandbox stopped working.
Hi.
I updated today to version 3.2.2 of the iPad iOS and I noticed that my In App Purchase testing was not working.
I am using a test account and everyhing was working until now (our app is already live since june and the real in app purchase works), but today I wanted to make a test purchase with the same product and test user that I always used and now it's not working.
The problem is as follows:
I start the in app purchase.
Confirm the purchase and sign in with the test user.
Because this is a non-consumable product the App Store notifies me, that I have already purchased this but it hasn't been downloaded.
Press OK.
Up until now the transaction observer got a transaction with the transactionState SKPaymentTransactionStatePurchased and the user got his/her in app feature.
But now the transactionState is SKPaymentTransactionStateFailed with the error:
Error Domain=SKErrorDomain Code=2 UserInfo=0x2debe0 "Cannot connect to iTunes Store"
Code=2 means SKErrorPaymentCancelled. WTF? This should happen if the user canceled the transaction, not in a real error. This is very misleading. I am not supposed to show this as an error because most of the time this is called if a user really cancels his/her purchase and there is no way to determine whether this error was caused by the user or by the App Store.
Everything is set up correctly, as I mentioned the in app purchase testing worked and I get the products as valid. Also I didn't change the code handling the in app purchase.
The error must be somewhere on the App Store side.
Does anyone else had this problem?
Thank you.
Update
I tested the app on the iPhone (it's a universal app) running iOS 4.0.2 and the error looks like this:
Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo=0x2620e0 {NSLocalizedDescription=Cannot connect to iTunes Store}
The Code=0 is SKErrorUnknown and the app displays an error to the user.
So it seems that iOS 4.0.2 handles this problem better than iOS 3.2.2.
I tested again and fortunately it seems that the problem is gone. I can test the in app purchase without any problems.
I hope it works now for others, too.

Resources