iOS In app purchase "Cannot connect to iTunes Store" error - ios

I know that it usually takes 24-36 hours before an in app purchase becomes available for a new app. But I have a problem where an approved IAP is unavailable even after several days.
It works in the sandbox environment and I've used the same code in other projects, so I'm pretty sure there's nothing wrong with my code.
I know I can get the product correctly since I display the price in local currency. But when I begin the purchase I get the "Cannot connect to iTunes Store" error.
Does anyone else have problems with this recently?
It seems to be a lot of strange errors in iTunes Connect, Xcode and AppStore since the release of iOS 11.

Related

IAP - Cannot connect to iTunes Store - only during apple review

I added in-app-purchase (one non-consumable, "unlock premium" item) to my iOS App, and during testing on iphone8 (dev.prov) with sandbox user, it works nicely.
However, when I send for review (distr prov), they reject it, as purchase fails with "Cannot connect to iTunes Store". They attached a screenshot.
I set up everything properly (tax/bank info, bundle id, in-app-purchase item, itunesconnect, apple dev site, etc). All apple services status are green. Searching all forums, helps, code, etc in the last days, but I do (as I see) everything as I should.
To tell you, during test, I also had sometimes "Cannot connect to iTunes Store" errors, but usually re-try solved it. This was on 11.0.2. Yesterday I upgraded to phone to 11.2.6 (same as apple reviewers use), since that, I had no even occasionally "Cannot connect to iTunes Store", works like charm. Create new sandbox tester, logout AppleStore on phone, reinstall app, initiate purchase, enter new sandbox tester appleid/pwd, and purchase complete. Repeat with other sandbox email, works. Repeat, works...
Restore purchase - also works.
If I uninstall and purchase again with the same testers, it asks "do you want to get the item for free" - also works as it should.
But for reviewers, it fails.
What else can I do in this case?
Edit:
Their message starts: We discovered one or more bugs in your app when reviewed on iPad running iOS 11.2.6 on Wi-Fi connected to an IPv6 network.
I tried doing purchase with "airplane" mode, and I got the same error: Cannot connect to iTunes Store. But I expect testers don't test IAP without internet, that would be stupid, and my error message would be proper that case.
However, I did not test on IPv6 (I don't have), could it be that my App IAP does not work on IPv6, thus behaves like in "airplane" mode?
You should test on IPv6 as well. See the link below on how to set up an IPv6 testing network on your mac. If IAP does work for you on IPv6, I would write the review team and ask them to either try again or provide you with more info on how to reproduce the issue.
http://www.brianjcoleman.com/tutorial-how-to-test-your-app-for-ipv6-compatibility/
Also, please note that many developers have been having issues with the sandbox environment lately:
https://forums.developer.apple.com/message/300072
Just an update, after a while, after a few ping-pong with review team, it got accepted, and since that, it works fine (also for review team during app updates).
Probably some internal issues they had.

SKErrorDomain Code=0 in In-App Purchase

Today, when testing IAP in sandbox mode, we suddenly got SKPaymentTransactionStateFailed with Error message:
Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
Then the alert comes
It works before, we did not change any IAP related Code.
I have searched stackoverflow and google and tried these:
Test with device, not simulator,
Make sure product id is right.
Make sure the build number in XCode General Settings is right
Create new sandbox test account in iTunes connect, and logout all other account, then test with sandbox test account.
Reboot/Reset the device
Make sure apple developer account is not renewed recently
None of these works for me. Any suggestions?
Update: I think it is the iTunes Connect Server problem, it is solved now.
There seems to be a bug going on just now. Our logs show increased errors in both production and sandbox. So far we haven't seen any solution yet.
--Edit--
This has been fixed.
Voting to close this issue to prevent confusing future similar problems.

Unity IAP for IOS -- No App Receipt found

I am trying set up some in-app purchases through Unity IAP for iOS devices. Registering the various product IDs, the initialization process seems to have passed successfully. However, when I tried to make a purchase using an iPad connected to a Mac, I received an error message on XCode saying:
UnityIAP: No App Receipt found
The purchase failed. The reason given for the error was: Unknown.
On the Unity editor, the purchase did go through without any problem.
So what could be the reason? What is an App Receipt?
I hired a freelancer to fix the issue. He asked me to test the system with a test user's account, and it succeeded. Apparently, for the IAP to work, all I needed to do was to release and publish the game in the Apple's App Store, and download the app from the App Store directly!
It is also worthwhile mentioning that we need to fill in the forms at Agreements, Tax, and Banking. Otherwise the initialisation process won't even pass.

My app is getting a very high percentage of in app purchases failing due to "Cannot connect to iTunes Store" in the released version of the app

I added in app purchase to my app and everything works great when I tested it in the sandbox. The app is currently in production and users are successfully making in app purchases as I can see the data in the sales report in iTunes Connect. In my app I track when a user starts the process to do an in app purchase and then if it was successful or not. 72% of the time that a user starts an in app purchases it fails with the error "Cannot connect to iTunes Store". My app has enough users making purchases that this is in not due to a small sample set, (i.e. 3 of the 4 users who did an IAP failed). While I have a decent amount of user's successfully making purchases, 72% seems very high to fail with "Cannot connect to iTunes Store".
Does anyone know what can cause this error in production? Is there something I am doing wrong in my app or can I give a better error message to users so that they know what is going on? When I searched stack overflow for this question I found a lot of posts about this error in the sandbox or happening on EVERY purchase, but I did not find any posts about when this happens sometimes in production.
This error occurs when the user initiates and then cancels a purchase.
Because the text in the NSLocalizedDescription of the NSError is not very helpful, I show my own error message instead.

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