[SOLVED] IAP - Cannot connect to iTunes Store

Edit: Full wipe was the only way to fix the issue after all.


I’ve been testing my IAP (consumable items) against iTunes Connect Sandbox. It’s been working perfectly fine until I started doing more “creative” (or maybe “harsh”) testing to cover all possible cases, and suddenly, I can no longer buy items.

What I get now is, “Confirm your In-App Purchase” popup that details what I am about to buy plus the price for the item. I tap on “Buy”, and it asks for my test user’s password, so I enter it (and sometimes it skips the password request). Then, after a moment, I get a popup message that says “An unknown error has occurred” with the option to “Cancel” or “Retry”. Retrying simply pops up the same unknown error message (sending me to never ending loop), and canceling results in “Transaction failed” notice.

The Xcode console says “Cannot connect to iTunes Store” as the cause of the error – but I have a feeling it isn’t about not being able to connect to iTunes Store, but something else. (Because if it couldn’t connect to iTunes sandbox, why was it able to fetch the item info from the iTunes anyway.)

Has anyone ever experienced something like this? Will this resolve itself if I wait a while? I googled, and this post on stackoverflow says “do a hard reset (full wipe) of your iPod (Settings => General => Reset => Erase All Content and Settings).”

What does it mean? I really don’t want to do this full wipe. Erasing all content? Noooo! Please tell me I don’t have to do that…

Again, the purchasing process worked perfectly fine until I intentionally and repeatedly crashed the game by tapping on multiple “buy” buttons while jumping from scene to scene. When I tapped on a single buy button (i.e., just a single purchase request), jumping from scene to scene did not interfere with IAP purchase process, and transaction went through perfectly fine. It was after I did more intense testing and intentionally crashed the game by tapping on buy buttons on multiple screens in rapid succession… It feels like iTunes Sandbox suddenly gave up on me. But will it ever correct itself on its own? Do I need to reset something somewhere…?

Naomi
[import]uid: 67217 topic_id: 20378 reply_id: 320378[/import]

I haven’t experienced this issue, but since I just got IAP implemented I wonder if I’ll run into this issue. I’m also trying to make my app more robust.

Have you tried deleting the app off the device and reinstalling it? What about logging out of your test user account and logging back in? Try another test user account? [import]uid: 27183 topic_id: 20378 reply_id: 79660[/import]

Hey, Don, I tried deleting the app off the device and reinstalled it. No go.

I logged out of the test user account, deleted the app again, reinstalled it, and tried again with the same test user account. No go.

I logged out again, deleted the app again, reinstalled it, and tried again with new test user account. No go.

It seems like I just have to do the hard reset (full wipe) after all. Ugh, what a pain. I’ll report back whether or not it fixes it.

Naomi [import]uid: 67217 topic_id: 20378 reply_id: 79773[/import]

Okay, the hard reset (full wipe) did the job… Sheesh, it makes each intense testing & fixing session very very long. Hopefully, no more crash bug with the latest fix.

And… maybe users won’t do things like tapping on multiple buy buttons, but simply wait for each transaction to complete before tapping another buy button to buy something else… but then… I know they will do things like that if allowed. So… I need to squash any opportunity to launch purchase process if a purchase process is already in progress. Sounds easy enough to do, but somehow, there are many holes I need to plug (because I didn’t code my purchase mechanics with this problem in mind to begin with). Yikes.

Naomi [import]uid: 67217 topic_id: 20378 reply_id: 79840[/import]

Good to know you were able to resolve the issue. QA is definitely a long drawn out process. It’s good to get your game into people’s hands and have them try to break it. [import]uid: 27183 topic_id: 20378 reply_id: 79843[/import]

Yeah, I agree. I don’t think I can thoroughly test and debug every possible outcome. Hopefully, I’ll get most of the obvious issues taken care of, though. (But it’s not so easy. IAP is definitely a finicky beast.)

Naomi [import]uid: 67217 topic_id: 20378 reply_id: 79887[/import]

Ahhhh… Finally fixed… I was having a similar problem with IAP.

What was happening:
I have implemented iap in the past with no issues. This time round when trying to make a purchase I was getting a failure with errorString “Cannot connect to iTunes Store”. (This error was happening before getting the purchase confirmation dialog)

Solution:
After a whole lot of looking around I realized that the DEVELOPMENT PROVISIONING PROFILE I was using was not associated with the correct app (I was just using the old development profile from my first game).

I created a new Development Provisioning profile associated with the right app (ensuring no wild cards), Now everything is just peachy!

[import]uid: 65285 topic_id: 20378 reply_id: 80974[/import]

@punya.huxter, that’s interesting. Don’t you use Ad Hoc to build for the device and test it against the iTunes sandbox? When I first implemented IAP, using Dev certificate when building for device caused me massive amount of headache, but as soon as I switched to Ad Hoc, it worked. I’m puzzled by your solution…

BTW, I had to do the hard reset (full wipe) again today. What a pain, but it solved the issue for me again.

Naomi [import]uid: 67217 topic_id: 20378 reply_id: 80976[/import]

Hi Naomi,
Ive never tried using an Ad-Hock Distribution profile.
Ive just been using a Dev Profile and it works fine for me when testing iap.

I looked around on stack overflow like you found a few people with solutions to our iap problems… One was doing that reset (no thanks)

Other people had success by creating more test accounts in itunes connect. Maybe that’s worth a shot. (Certainly if you don’t have any test accounts set up this would be a problem)

itunesconnect -> Manage Users -> Test user -> create a new one… [import]uid: 65285 topic_id: 20378 reply_id: 80979[/import]

Hey, @punya.huxter, I have test users, and when things get wacky, using new test users wouldn’t solve the problem I encounter. So… I just tried the clean wipe, and that was the only thing that solved mine.

It’s interesting to hear you never use Ad Hoc when generating a device build via Corona SDK, and you can still test IAP against iTunes sandbox. If it works for you, that’s all good anyhow.

Naomi [import]uid: 67217 topic_id: 20378 reply_id: 80986[/import]

Well if the wipe is working you should probably stick with it for now. Good Luck and all the best with your app! [import]uid: 65285 topic_id: 20378 reply_id: 80993[/import]

Thank you, and I wish you the same. Best of luck!

Naomi [import]uid: 67217 topic_id: 20378 reply_id: 80997[/import]

@punya.huxter
O man! Thanks a lot!
I was almost doing the same mistake. Was using a certificate with a wild card.
All is well now! [import]uid: 64174 topic_id: 20378 reply_id: 109536[/import]

i have run in app purchapse code applications. but application run on xcode simulator it has not connect to itune connect store. how to solve that problem? help me plz…

in app purchase app run in xcode simulator but it not connect to itune connect store… what is problem … get answer help me plz.

i have run in app purchapse code applications. but application run on xcode simulator it has not connect to itune connect store. how to solve that problem? help me plz…

in app purchase app run in xcode simulator but it not connect to itune connect store… what is problem … get answer help me plz.

Make sure the following settings are set for inapp purchase to work:

  1. go to iphone or ipad Settings>Game Center and enter the Test user 's  Apple ID and password

  2. go to iphone or ipad Settings>iTunes & App Store and use the same Test User’s Apple ID and password

I think most people fail because they entered different account for ipad Settings>Game Center and Settings>iTunes & App Store.

Make sure the following settings are set for inapp purchase to work:

  1. go to iphone or ipad Settings>Game Center and enter the Test user 's  Apple ID and password

  2. go to iphone or ipad Settings>iTunes & App Store and use the same Test User’s Apple ID and password

I think most people fail because they entered different account for ipad Settings>Game Center and Settings>iTunes & App Store.