Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Domain=SKErrorDomain Code=2 "Cannot connect to iTunes Store" UserInfo=0x6083900 {NSLocalizedDescription=Cannot connect to iTunes Store}

I am trying to test my in app purchases using a test account. The first time I try to purchase an in app auto renewable subscription, everything goes smooth, no errors and the transaction is complete as expected with the transaction state updated to "SKPaymentTransactionStatePurchased". But, when I test for the scenario of a user trying to purchase the subscription again, I keep getting the above error. Even though the store kit framework displays a dialog saying that the user is already subscribed, my observer sees the transaction as failed in the state(SKPaymentTransactionStateFailed).

The storekit documentation clearly says "If the user attempts to purchase a nonconsumable product or a renewable subscription they have already purchased, your application receives a regular transaction for that item, not a restore transaction. However, the user is not charged again for that product. Your application should treat these transactions identically to those of the original transaction". In my case here, I keep getting the transaction state as "failed" when I do the purchase again.

Any ideas? This is in the sandbox test environment.

like image 618
user648630 Avatar asked Mar 07 '11 20:03

user648630


3 Answers

This is the expected behavior. You still receive a transaction, it just marks it in a failed state because it does not represent a new, successful purchase. Repurchasing a subscription they already subscribe to (presumably to restore a purchase after a fresh install) is not a journey you should encourage your users to take, they should be directed towards the restore purchases function.

Arguably you might want to interrogate your failed purchases every time to see if this is what the user was trying to do, but then you'd have to do a fair amount of messing around to try and distinguish which ones were genuine failures and which one's were erroneous restores. but I'd say it's much easier to have a big 'restore' button and direct people towards that.

like image 109
Sam Clewlow Avatar answered Nov 02 '22 12:11

Sam Clewlow


If you log out from the app store application, it seems to be working when you purchase again. But problem continues if your user try to purchase the same product twice.

like image 29
Robert Childan Avatar answered Nov 02 '22 12:11

Robert Childan


I was getting this when the Sandbox servers were down and/or broken. Check on Apple's developer forum to see if anyone else is getting the same thing.

[Developer Login Required] http://devforums.apple.com/community/ios/integration/storekit

like image 2
Wex Avatar answered Nov 02 '22 12:11

Wex