Why In-App purchase sandbox always ask "Verification Required"? - iphone

I have signed out from the store in device settings.
I entered user credentials only in my App.
I have set up a brand new (actually around 4 times) test user.
Why this message keep poppin' up?
Is it something connected to iOS 5, automatic app sync, or iCloud?

I had exactly same problem with sandbox in-app purchases, in built-in model (no receipt verification), app received valid products, now i called addPayment, everything alright. But now "Verification required" appeared and payment was canceled.
After hours of pain I discovered, my problem was in test account.. i created test account for Czech Republic iTunes store... and that was the reason of fail. Dumb.
I tried to create Canadian test user and it suddenly worked! "Verification required" will no longer appeared.

I've dealing with this problem for about one week, trying to use accounts in US/Canada without any success. Finally I found this post and it works:
http://iphonedevsdk.com/forum/iphone-sdk-development/63008-in-app-purchase-test-account-verification-required-cant-get-passed.html
You need a test account that NEVER has a credit card attached to it, NEVER is logged into itunes store or app store via device, and if you do login to itunes or agree to any app store stuff it voids the test account and will never work again.
So, To test your In App Purchase app, you need to use a new account that does not have a credit card. logout of the store, and only use your new account inside the app you are testing.
Update: After a long time system maintenance of iTunes in Sept 2013, only test accounts in US can make test purchases.

I have struggled with this myself, i finally found a workaround that worked for me...
On the device Log out of iTunes account in settings (also hard close settings and iTunes if you have them open as a precaution)
Delete app
Create a new test user at “itunesconnect.apple.com” – selecting the United States as your store
Reinstall app
Try to make a purchase in the app
Enter you new test user account details
If a pop up states that it needs to swap stores, immediately press home. DO NOT press OK.
Relaunch the app, and try again. It should now work as expected.
Hope this works...

In addition of the above answers, note the below points also :-
1) Uninstall your app from the device.
2) Create a new test account on iTunes Connect and verify its email address. Never add any payment information for this test account, not online, not on iTunes, not on your device. Doing so might invalidate your test account (and trigger the "verify payment info" vicious cycle.) Also never use this test account out of the Sandbox.
3) Log-out from the App Store on your device. DO NOT log back in the App Store via Settings > iTunes & App Stores on your device. You will be asked your login credentials from your app later (see points 5-6)
4) Re-install your app.
5) Attempt an in-app purchase. You should now be prompted to enter both your username and password (as you logged out from the App Store)
6) Type in your username and password: you should not see the dreadful "Verification Required: before you can make purchases, you must verify your payment info" message and the purchase should be successful.

Even in sandbox, you need to complete the buy verifying the receipt to the server.
It corresponds to steps 6-7-8 of built-in model and 11-12-13 of the server model.
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/APIOverview/OverviewoftheStoreKitAPI.html
All you need to do is:
Retrieve the receipt data from the transaction’s transactionReceipt property and encode it using base64 encoding.create a json like this:
{
"receipt-data" : "(receipt in base 64 encoding)"
}
Make a post to verification URL for production:
https://buy.itunes.apple.com/verifyReceipt
For sandbox :
https://sandbox.itunes.apple.com/verifyReceipt
The response is like this:
{
"status" : 0,
"receipt" : { ... }
}
If the value of the status key is 0, this is a valid receipt.
If the value is anything other than 0, this receipt is invalid.
For further information look the guide:
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html

Swift 3
Insert this temporary code somewhere in your project:
for transaction: AnyObject in SKPaymentQueue.default().transactions {
guard let currentTransaction: SKPaymentTransaction = transaction as? SKPaymentTransaction else {return}
SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction)
}
This clears out the payment queue. Make sure to run it much later than viewDidLoad if you can. I made mine triggered by a button. Ran it a couple times, then removed the code. No more annoying verification pop-ups.

I saw this issue after iOS5 got released.
Earlier I used to create test accounts with dummy email addresses and it used to work well for me, but post iOS5, it started showing verification required for test accounts.
Thus I ended up using actual email addresses for the test accounts and verified when asked for, which seemed to do the trick for me.

I was facing same problem after spending several hours i figured out that county/region of your itunes connect test account and your device/simulator must be same.
Please verify it as it solved my problem

Register a fresh test user for the USA. You can put any email address.
Log out under settings.
Delete the app.
start it again via xCode
login with your new user within the app.
It may say that you are not located in the USA and it opens the browser, Close the browser and start it again.
It should work now.

If you are having such problem for 4th IAP item to buy.
It looks, each test account does not work for purchasing more than 3 items of an application. You may create a new test account from itunesconnect.apple.com->Manage Users->Test User to test your 4th IAP item.

Creating a canadian test user solve this issue.

Related

in app purchase test account not working in IOS?

we are testing in app purchase with sandbox test account and at time of testing it shows Verification and after verification of payment info when i tried to test in app purchase it redirects me to app store and app store shows time out
am i doing anything wrong?
i have also created three more sandbox test account for testing in app purchase. but same error occurs.
Please help.
For me to fix this issue, I simply registered a new user in iTunesConnect, but I set their store to 'USA'.
Step 1: Create the test account online.
Step 2: Log out of the current account in Settings.app > App Store.
Step 3: DO NOT log into the test account yet.
Step 4: Build and run your app on the device, signed with a Development profile (not ad-hoc).
Step 5: Make your purchase. It'll give the UIAlertView, via which you sign into the test account.
If you sign into your test account via any other mechanism, and especially if you add credit card info, that test account will be permanently broken. I recommend trying my steps above with a brand new test account. To make them easier to remember, I usually suffix my test account names with a number, and increment it each time.
This is a bug from apple server side. because from last couple of days many test accounts are not working.
Been having similar problem, getting better by doing this;
Create a new account in iTunes connect - DO NOT LOG IN OR ANYTHING! (this seems to be important)
From the device (not simulator) sign out of any account.
Run the app and try.
My problem is now confirming I have some kind of purchase.
Starting from iOS 12,There is a separate section to sign in sandbox account in iphone settings. This allow us to test in sandbox without sign out from iTunes account.
I don't think you're doing anything wrong. The verification is about filling up some missing fields, but you don't have control once the user press Continue button, so chances are there's something wrong with the itunes verification site; just keep trying a while after.
I had a similar problem, when the test user was not in the correct Apple developer Account. Make sure in iTunes Connect, that your test user is indeed in Test Users.

iTunesConnect test user verifying

I create iTunes connect test user, but when I am trying to test in-app-purchase, my app in iOS simulator says, that i need to verify my apple id. How can I do it?
Text of error view:
You haven't verified your apple id.
Tap OK to see instructions.
When I taps OK, it hides alert view and it is end.
This has been happening to quite a lot of people in the last couple days and there is a thread in the Apple Dev Forums: https://devforums.apple.com/thread/128982?tstart=0
No need to verify it,
Actually its a dummy account for testing purpose. So, if you enter dummy email id which is not exist will be fine. And if you try to enter real email id, then it send you verification mail. But don't worry if you're not verify that that will work fine.
But better you should apply dummy email id instead your real email id to avoid this confusion...!?!
It's some times happens. But you can test in-app purchase with test user.
Just make sure below points:
1) You test the app in device (not simulator).
2) Before test the in-purchase, you should be logged out from app store on device.
Cheers.
I just ran into this issue and it seems there is a simple way to rectify the issue.
Issue:
After creating an Apple ID(best to use a fake email that doesn't exist to reduce headache) for a test user account in Albania, I signed out of the normal Apple ID I use from within "Settings>iTunes & App Stores" and leave it signed out.
Then I start the app I'm testing, attempt to purchase anything within the app, at which point I'm prompted with a message that asks to use existing Apple ID or Create New Apple ID.
I choose the Use Existing Apple ID option.
Then I'm prompted to enter email & password.
This is where you enter the test user account info you've created in iTunes Connect.
After entering the test user account info, a message saying that this profile/account has not been verified/used on this market previously, then I tap "OK", and it redirects me to the App Store.
At this point do not do anything further within the app store or the prompts that appear within it, it will just create further confusion/problems
Instead, back out of the store, and re-open the app your testing. At this point, try to purchase that same item again and it should work just fine.
I have no idea why it redirects you to the app store to begin with, but for whatever reason it does. It does seems strange that in-app purchase testing would ever re-direct you to the store, but it just does, so try to ignore the idiocy and move on. Just pretend it didn't happen, and go back into your app as if nothing happened and everything makes sense.
Hope this helps
We all have to file bug report to Apple so that it gets addressed faster. AFAIK Apple does not really care about discussions in their devforums.
And yes, I started experiencing the very same problem since Oct 21.
I found problem. Now we must use our real email and they will send email to verify it.

Clearing purchases from iOS in-app purchase sandbox for a test user

Does anyone have any ideas on how to reset and/or clear the iOS in-app purchase sandbox?
I have an app that I'm testing with the sandbox, and I'd like to test new purchases without having to create a new test user every time I purchase something.
If I don't do this, then I (of course) always get a message that the in-app purchase item has already been purchased when I click on my app's buy button.
IMO there are 3 things you can do to make testing non-consumables bearable:
You can have many test accounts associated to one email. Gmail for example lets you add a "plus" string to the email to create aliases for an address: so tester+01#gmail.com and tester+02#gmail.com both really just go to tester#gmail.com. Probably other email hosts do the same. When you create a test account you need to introduce: first name, last name, email address, password, secret question, secret answer, date of birth, and iTunes store country. You can put exactly the same data (including password) for tester+01#gmail.com and tester+02#gmail.com and you will have two test accounts. Finally, in your tester#gmail.com inbox you will receive two verification emails from Apple to confirm both test accounts.
Say that you have a non-consumable with product ID #"Extra_Levels". Instead of writing #"Extra_Levels" in all methods (requestProduct, purchaseProduct, ...), just write PRODUCT_ID1 and at some header file put #define PRODUCT_ID1 #"Extra_Levels" (with no semicolon!), then the preprocessor will search PRODUCT_ID1 and substitute it for #"Extra_Levels". Then creating a new non-consumable called #"Extra_Levels_01" and changing the #define will be as good as resetting the purchases for all your test users.
As appsmatics pointed out, you can test the correct behavior of your code when you buy a non-consumable IAP by first using a consumable IAP (so that test user can make as many purchases as needed) to get rid of some bugs. Of course, you should also test the code with the real non-consumable IAP after that.
You can't do this, as far as I know. The sandbox backend works like a real account-- once it's purchased, it's purchased (and thus you can test restore). You should do most of your development with the store stuff shimmed out, and then when you get to testing it for real, just expect to create several test accounts.
You can clear the purchase history for a tester so that you can continue to use the same sandbox Apple ID for ongoing testing. Clearing purchase history will delete all past auto-renewable subscriptions and non-consumables purchased by the selected testers in the sandbox environment. In-app purchases made by customers on the App Store are not affected.
To clear tester purchase history:
From Users and Access, under Sandbox, click Testers.
Click Edit.
Select the checkbox for each tester you want to modify and click Clear Purchase History.
Click Clear Purchase History in the dialog that appears.
Sandbox Apple IDs with a high number of purchases may take longer to clear. This action cannot be reversed.
I have 2 in app purchase items.
1 for production.
and the other for testing. when I need to "clear" I delete the in app item and create new one (15 seconds in itunes connect and 1 second to change the product id in code)
if i dont need to test "new user", i use the production in app item.
Deleting your app and reinstalling works also for sandbox testing. Depends on the app obviously, but I'm testing a subscription based app that only purchases during sign up at the moment so it's been the easiest solution.
Well, technically you don't need that.
If you get SKPaymentTransactionStateRestored, it is 100% equivalent to the app store verifying the user and granting him the purchase. I have a switch like:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for( SKPaymentTransaction *purch in transactions )
{
switch( purch.transactionState )
{
case SKPaymentTransactionStateRestored:
info( "PURCHASE RESTORE" ) ;
// fall thru
case SKPaymentTransactionStatePurchased:
[[SKPaymentQueue defaultQueue] finishTransaction:purch];
// Do regular changes to app state for this purchase,
// register in keychain, etc.
break ;
//.. other cases
}
}
}
The question of having your app logic / take back the purchase is simple: if you're caching purchases in keychain, delete your keychain. If you're doing it some other how, just change your local app state to pretend like the user never purchased it before. The request to purchase dialog is still exactly the same, the only difference is when you punch YES, it gives you SKPaymentTransactionStateRestored instead of SKPaymentTransactionStatePurchased.
You can clear the purchase history for a sandbox Apple ID in App Store Connect.
To clear tester purchase history:
From Users and Access, under Sandbox, click Testers.
Click Edit.
Select the checkbox for each tester you want to modify and click Clear Purchase History.
Click Clear Purchase History in the dialog that appears.
see Documentation https://help.apple.com/app-store-connect/#/dev7e89e149d
Check out SimStoreKit. It's a "simulated version of the iPhone's StoreKit, for testing store UIs on the iPhone Simulator, or even on device without having to set up IAP in Connect."
SimStoreKit stores purchases in the user defaults under the key ILSimSKTransactions. So to clear all purchases you can do:
[[NSUserDefaults standardUserDefaults] removeObjectForKey:#"ILSimSKTransactions"]
On the simulator, you can simply remove your app and install it again.
I've successfully used SimStoreKit to debug my app's store front before testing with the sandbox. The beauty of this library is that it can be set-up to use the same class names as the real StoreKit framework (by doing #define ILSimReplaceRealStoreKit 1 before doing #include <ILSimStoreKit.h>).
In source files where I need to access StoreKit, I include this header file:
#import <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR
#define kILSimAllowSimulatedStoreKit 1
#define ILSimReplaceRealStoreKit 1
#import <ILSimStoreKit.h>
#else
#import <StoreKit/StoreKit.h>
#endif
This has the effect of using SimStoreKit when I run on the simulator and the real StoreKit when I run on the device.
This is now possible for subscriptions purchases through Reset Eligibility
On the test iOS device, open Settings > Apple ID > Media & Purchases (or iTunes &/or App Store for iOS 13 and earlier). Under the Sandbox Account section, tap your highlighted Sandbox Apple ID then tap Manage to open the sandbox Subscription Management page.
If the subscription has expired, tap one of the options to resubscribe.
Once you resubscribe or when you have a subscription going on, you can use the Reset Eligibility button to reset and redeem another introductory offer (trial or discounted price).
Just keep using the same test account, restoring purchases as opposed to completing new ones. After all, whether you start a new purchase or restore an old one, YOUR APP will do the same thing (at least initially, maybe the user interface will update differently upon completion). Apple are the folks handling things differently in those different situations - don't worry about it.
Place your delivery logic in the SKPaymentTransactionStateRestored case within this method's implementation for testing:
- (void)paymentQueue:(SKPaymentQueue *)queue
updatedTransactions:(NSArray *)transactions;
Then be sure to put that delivery logic into the SKPaymentTransactionStatePurchased case.
At the end, because most of us are obsessive-compulsive to varying degrees, do a final test with a fresh account (not a big deal to make a second one for absolute certainty).
The final thing to note: consider apple's position. If there was a problem with developers having to waste time creating tens or hundreds of accounts to test IAP thoroughly, they would have solved the problem. There is no problem.
alternatively to create multiple test user solution you can create multiple test in app purchases in iTunes connect then you don't need to change a user account.

In App Purchase An unknown error has occured

I have created a test app that has in app purchasing. I am able to connect to the store and verify my product ID's. I then use my test user account to purchase a product. And guess what... it works... the first time. If I try to use the test user account to buy another product (the same product or a different one) then I get a pop up that says
"An unknown error has occurred"
with a "Cancel" and "Retry" option. If I retry then I get the same error. After hitting cancel I get the error:
Error Domain=SKErrorDomain Code=0 UserInfo=0x161180 "Cannot connect to iTunes Store"
Any ideas?
Update:
I have found a work around. For some reason apple does like Canadian test users. I switched to using US test users and everything worked.
I also found that after an OS upgrade I needed to delete the app off my phone and do a clean build to get things working again.
So the issue here doesn't have anything to do with wether or not your iTunes connect user is in Canada or the US. It's kind of a strange bug on Apple's side.
What happens is if you sign-out of an iTunes connect user in Settings.app and then sign back in with that user in Settings.app that test user is somehow poisoned and is broken permanently. You will no longer be able to use that account for testing.
To avoid this sign-out in Settings.app, but don't sign back in until you are inside your application and it prompts you during purchase.
I am having this EXACT same problem. I have some more details so let's get to the bottom of this!
When I create a new tester account, the first purchase always works. The second time gives me an alert that says "You've already purchased this but it hasn't been downloaded..." on the device. Every time after that I get an "Unknown error has occurred" message.
My NSLogs gives some more info. The first payment is normal. But it gets weird for any payment attempt after that. After I send the payment request and make myself a queue observer, I see TWO transactions in the purchasing state... weird, why two? After I get the error and tap cancel, I get two transactions in the failed state sent back. Why would I get two responses when I only sent one payment request?
I am using a consumable product type that the user should be able to purchase over and over again.
This worked perfectly for me the last month of testing. It only started acting like this in the past week. The two transactions seems to be from Apple's side, because I can't see any way my code might be causing it. Perhaps Apple made some changes to their purchasing system and haven't worked out the kinks yet.
In my case, I was logged in with another sanbox tester account(of different developer account I mean) in Settings -> iTunes & App Store -> Sandbox Account.
I simply logged out and then tried again to perform the In-App Purchase. And so it asked me to login with another sandbox account. I did so and it worked as it should!

iPhone Store Kit "Cannot connect to iTunes Store"

I am working on adding In-App purchases to my app.
I am able to receive the productsRequest:didReceiveResponse method, and receive the array of products.
My problem arises when I add a SKPayment to the SKPaymentQueue. After I add the product to the queue, in the paymentQueue:updatedTransactions method the transactions always have the state SKPaymentTransactionStateFailed.
I NSLog the "transaction.error" and this is what it returns: Error
Domain=SKErrorDomain Code=0 UserInfo=0x165000 "Cannot connect to
iTunes Store"
I have logged out of the Store in the Settings app, but after trying to purchase a product in my app it never asks me to log in with my test account. It just fails with the above error.
I was getting SKPaymentTransactionStateFailed error code 0 "Cannot connect to iTunes Store" and thanks to thomax for this answer my problem is solved. Turns out you MUST enter a build number under Targets->Summary.
I spent the last 24 hours resetting my phone, screwing with iTunes connect, and doing just about everything i could think of before i stumbled upon this solution.
I assume you've done the standard sanity checks: double-checking your code, confirming your product IDs, comparing your code to the In-App Purchase Programming Guide, etc.
This may be ridiculous, but -- if you're certain your code is correct -- do a hard reset (full wipe) of your iPod (Settings => General => Reset => Erase All Content and Settings). I puzzled over this exact problem for hours -- it turned out my code was correct and the hard reset was the solution.
I had been getting the same error but I had been prompted for my test user account. And also a popup saying "An unknown error has occurred". It turns out that when I created my test user account and signed out of the settings -> store I had decided to sign in with my test user account which had prompted me for a bunch of information including billing, which had broken my test user account. When I created a new test user account and only signed in when prompted to during the in app purchase testing, everything worked smoothly.
This error (i.e. "Error! Cannot connect to iTunes Store") can occur if you do a sandboxed In App purchase but are signed in using your normal Apple account.
I find it helps avoid any confusion if I sign out of my Apple account before doing any In App purchases. Then in the "Sign In" dialog choose the "Use Existing Apple ID" option and enter your Test User details.
Just remember this will be set in your Settings so you will need to sign out after you've finished In App purchases.
Also, using a different Apple ID resets various iTunes-related settings such as iTunes Match.
You can check if the following link is working or timing out:
https://sandbox.itunes.apple.com/verifyReceipt
Alternatively, an unscientific but quite reliable way to check if the sandbox is working is to ask at:
https://devforums.apple.com/community/ios/connected/purchase
If the sandbox is down, there will probably be people already talking about it, like now (18 Jan 2012, 6:40pm UTC time).
I also was facing with the same error.
I figured out, that the Error only comes on the Simulator, when I switched to the device debugging, the error didn't appear.
Simply log off from your AppStore account on settings...
Solved the problem for me because my device was logged using my regular Apple ID and because the purchases on the sandbox are always done with the test user ID, the device was trying to send my regular Apple Store ID to the "test" App Store resulting on this "Cannot Connect to iTunes Store" error.
This is the most common cause I have seen on my device.
Hit with the same problem, i reset my device, cross verified the identifiers, re-installed the app. Also thought the problem was, because I had changed the reference and the description of the products. In reality, I feel it is because my test user had got locked as multiple people where using the same account, and it is a possibility that the password validation failed multiple times.
So I re-created another test user and in-app purchasing is back to working.
Hope this helps. I was totally stumped with this error.
Make sure your BundleIDs match. That was my problem.
Even a full restore did not resolve this problem for me.
After calling addPayment for an auto-renewing product identifier, about one second passed before I received the "SKErrorDomain Code=0" error from StoreKit. At no point was I prompted (as Apple's documentation suggests one should be) for an iTunes Store username and password; the transaction simply failed.
To resolve this, I had to add a fake "consumable" product to iTunes Connect and call addPayment using the fake consumable's product identifier. This caused the iTunes Store dialog to come up. I then logged in with a test account I had created in iTunes Connect. This succeeded: my application was notified that the consumable had been purchased.
After having done this, I was able to call addPayment with my auto-renewing product identifier and purchase the subscription normally.
make sure you're testing with sandbox user accounts created from itunesconnect and not your actual apple id for your personal account when testing this stuff.
I thought it worth mentioning that DonnaLea's solution of only logging in when prompted for payment also worked for the same issue with Unity and Prime31's StoreKit plugin.
Attempting to log in via the same settings menu you use to log out will prompt for all manner of billing\address details which seems to permanently "break" that test account.
I found myself in this situation when I was working on adding in-app purchases and didn't do it exactly right the first time. In my case I had an error in server-side PHP and as a result I think I wasn't getting all the way through to "finishTransaction:". Even after I fixed the problems (I put the program on a separate device and purchased successfully), I kept getting "You've already purchased this, click to download" followed by "Cannot connect to iTunes Store".
I finally got it to stop doing that by launching the game from Springboard (not XCode). It immediately processed the transaction successfully and stopped prompting me to redownload.
This is similar to the accepted answer above. I started getting the "cannot connect to iTunes store" error when trying to log in to my iTunes account on my phone after logging in with an IAP sandbox account.
To solve the problem, I was able to just do a Reset All Settings instead of Erase All Content and Settings (Settings => General => Reset => Reset All Settings). Definitely better than having to lose and reinstall everything on your device.
I had had the same problem, first of all I haven't created test account so I created via getting help from this link
https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SettingUpUserAccounts.html#//apple_ref/doc/uid/TP40011225-CH25-SW10
Then You need to sign out from your current account on your device. and buy purchasing it will ask for user account, then enter the test account.
I had this same issue. I had previously created a test user account, and signed out of the itunes store expecting to be prompted with a sign in for my test user account when I made the in app purchase. instead I got the cannot connect to itunes store message. when I signed in with my real itunes username/password and tried my test app it worked perfectly. I then logged out of itunes store again and my app worked great, prompting me for my id/pw
I had the same error, but the problem was not exactly the same. Maybe usefull for someone:
I inserted an external file in the structure of my app. The reason why I did this is because in production, I insert this file dinamicaly from a server, but in development I thought it was faster to use an app called iExplorer to paste this file. I have done this is the past and I didn't have this problem. But in the last few days, if I paste this file directly using iExplorer, my app returns the error: "Cannot connect to iTunes Store". (in spanish: "No puede conectarse a iTunes Store").
I think that it is because this time I inserted the file inside the .app folder. So this makes me think that if you modify your .app folder in any way, the Codesignature breaks and the link with the iTunes Store stops working directly.
For me, the problem was fixed by uploading a binary. Since that answer was not given in this page, which seems to be among the top hits in Google, I thought I'd add it.
Figured I should share my recent experience with the same issue:
I experienced the same problem a few days ago, where it stopped working from one day to the other. I got the following error after having authenticated with my test user(s): Error Domain=SKErrorDomain Code=0 UserInfo=0x165000 "Cannot connect to iTunes Store"
I hadn't done any changes to the code and we couldn't think of any other changes to our iTunes account or IAP products that might've triggered the problems. The only thing that may have been related was the adding of more iTunes Test Users (although I've added ~15 accounts before without problems). I tested it on different devices and the simulator.
I went through all the available checklists and all possible solutions (everything mentioned above as well) without any success. Finally I figured I might as well take a break from it all over the weekend, since I was drawing blanks. And oddly (and for the first time ever), doing nothing actually worked!
I didn't change any code, nor did anything change on our iTunes account or the app.
The only reasons I can think of are:
Something was wrong on Apple's end.
Some other time-based factor with the app, a certificate or something caused the problems.
A leprechaun snuck into my office and fixed the issue.
Check if you are signed into your personal itunes account in the appstore. If you are you will receive this message. Even if you are signed into your sandbox account in the app. So, to resolve this issue sign out of your personal account in the app store and then try to purchase your in-app item and then use your sandbox account. This resolved my issue.
Well, as usual I "tried all solutions available and it didn't help" :)
So, here is my input to this unlimited collection of stumble stones:
If application is not currently on sale (at any reason), this error occurs.
I got the same error,
When I called SKProductsRequest's start method in my test env,
It ran in
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error
When I called in my production env,
It's correct and ran in
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
Close charles or any http proxy software asap!
Close charles or any http proxy software asap!
Close charles or any http proxy software asap!
You know it~
I had had the same problem, but I solved by the following mode:
- I was using iPhone 5S emulator with iOS 8.4 (This is the most important. Apple Store connection is not working on iOS 11 emulator)
- on emulator I turned on the following setting: Settings/Developer/Allow HTTP services (This is for internet connection)
- temporarily I turned off Avast antivirus Web Shield (This is for internet connection too)
The In-App Purchase FAQ has this information:
Cannot connect to iTunes Store
The "Cannot connect to iTunes Store" issue may be due to one or more of the following reasons:
The sandbox may be unreachable.
Your app does not have a bundle version (CFBundleVersion). See Setting the Version Number and Build String for more information.
Your app is running in the Simulator, which does not support in-app purchase.
You are attempting to purchase a product that is unavailable for sale. See Query the App Store for product information before presenting your app’s store UI for more information.
In my case, the error occurred because I was using the simulator.
Even in the In-App Purchase Programming Guide says to use the development iOS device has a suggested testing step.
As Apple's Documentation:
Cannot connect to iTunes Store
The "Cannot connect to iTunes Store" issue may be due to one or more of the following reasons:
The sandbox may be unreachable.
Your app does not have a bundle version (CFBundleVersion). See Setting the Version Number and Build String for more information.
Your app is running in the Simulator, which does not support in-app purchase.
You are attempting to purchase a product that is unavailable for sale. See Query the App Store for product information before presenting your app’s store UI for more information.
https://developer.apple.com/library/content/technotes/tn2413/_index.html
I have tried all what I can to deal with this issue.
Real device not Simulator.
New registered Sandbox test account (not fill the extra info to make it a formal Apple ID)
Logout whatever accounts related.(iCould, App Store, maybe other app's sandbox testing account)
Fill all the tax and Agreements in itunesconnect website
Even restore to factory settings LOL
...
always return SKErrorDomain Code=0
“Cannot connect to iTunes Store”
...
My case's solution is finally come tome after 3 days' struggle:
And finally I find the key. Try with another device to test the iAP if your device's iOS is iOS13.4.x!!!And I upgrade this ”broken“ device's OS version to iOS14.0.1, iAP works like a charm.