iOS IAP Cannot connect to iTunes Store - ios

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.

Related

Apple In App purchase with sandBox gets an error as “Your account has been disabled in the App Store and iTunes”

An iOS App has given for testing in TestFlight for testing In-App purchase
It used to test using the sandBox account, but now it's not working with sandBox and gets an error as “Your account has been disabled in the App Store and iTunes”.
Rechecked the product creation and checked the same - it's not worked.
Then created a new sandbox account and tried the same - its not worked, showed the same error.
Checked the issues in the web and from the related answers, tried to remove the account details from Settings --> iTunes & App Store - its not worked, showed the same error.
TestFlight users don't require a sandbox account, but they will test against an automatically created sandbox account.
This means it's no longer necessary to create test accounts in iTunes Connect.
Your TestFlight user is a legitimate App Store user, but doing in-app purchases made with beta builds are free within the context of the beta version.
More details available in the following section Testing in-app purchases with TestFlight by Marko Kruustük.

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 app rejection because subscriptions do not work on a simulator

I've got my app rejected because they're testing it in iPad simulator where subscriptions do not work and my app needs to be able to verify subscription before providing an access.
Right now my app is displaying an error "Can't connect to iTunes store, please try again".
What does Apple expect me to do?

how to switch from Sandbox to live in In App purchase

I am using In App purchase and it is working fine when i am testing it from the sandbox account. But when i tried to purchase the online subscription by making amount zero by live account. it is giving an error of
[you are not authorised to make purchase in this inApp in SandBox at this time Environment Sandbox]
i guess it was setup in sand box mode. So As i tested in sandbox and it is working fine ho can i make it live to that any one can purchase it.
I got my answer for the apple document that app installed from Xcode is always in Sandbox environment and app download from live itunes is Live. thanks a lot to all and specially for one who commented heae on post and guided me.
=>
StoreKit connects to the sandbox environment when you launch your application from Xcode, from your test device (iOS), or from the Finder (OS X). It connects to a production environment for applications that were downloaded from the App Store. You must not use your test user account to sign into the production environment. This will result in your test user account becoming invalid. Invalid test accounts cannot be used to test In-App Purchase again.
<=
Apple Document
You can not test live app with sandbox test ID as sandbox email ID has no real credit. If In App Purchase is working for sandbox ID, it will work for real IDs too.

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).

Resources