views:

216

answers:

3

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.

A: 

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.

Dan Carter
A: 

So I'm having almost the same issue. Same message - but the first purchase doesn't work (no purchases work - they all result in "An unknown error has occurred."

I tried creating a new test user. Same result.

Any ideas?

benvolioT
See my answer, if you sign in through settings.app consistently you will continue to see this problem.
Steve918
Thank you, thank you, thank you! I have been pulling my hair out over this for two days!Apple's quality continues to disappoint.I really appreciate the help!
benvolioT
+4  A: 

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 an embarrassing 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.

Steve918
It's mostly embarrassing because it's been since the launch of StoreKit.
Steve918
This is not the issue. I am aware of this "feature" of apples test user, and it is not the cause of this post