Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Cannot connect to iTunes store" when restoring iOS In App Purchase in iOS simulator

Tags:

I've looked through the many existing questions related to "Cannot connect to iTunes store" issues with iOS StoreKit and I don't think my situation is covered:

When running in the iOS Simulator, I get the "Cannot connect to iTunes store" error after restoring a previous bought in app purchase. If I hit Cancel, the popup goes away and the restore is successful.

There is no problem at all when buying the in app purchase, only when restoring.

Also, the problem only occurs on the simulator, not when testing on a real iPhone.

I'm pretty sure everything is OK, just wanted to confirm that it is just a simulator bug. Any one else seen this one?

like image 451
mluisbrown Avatar asked Mar 06 '13 21:03

mluisbrown


People also ask

How do you fix an iPhone that won't connect to the App Store?

Try logging out and logging in again First, try logging out and then log back into the App Store on your iPhone – that should fix it: Go to Settings > iTunes & App Store. Tap on Apple ID at the top of the screen, then hit Sign Out. Log in again using your Apple ID and password.

Why can't I make in app purchases iOS?

Answer: If you are having trouble making in-app purchases, check to make sure that in-app purchases isn't turned off on your iPad. Open Settings > Screen Time then select Content & Privacy Restrictions. Tap on iTunes & App Store Purchases then tap In-app Purchases and make sure it's set to "Allow".


Video Answer


2 Answers

Having researched this as much as I can, and confirmed that there are no issues when running on a device, either in sandbox mode or (since yesterday, when the IAP was approved by Apple) using a real Apple ID, I'm assuming this is a simulator bug and can be ignored.

Contrary to the answer posted by iLive below, and repeated elsewhere on SO, testing IAP on the simulator is explicitly supported by Apple, except for hosted content downloads.

UPDATE: It would appear that since iOS 7, testing IAP on the simulator is no longer properly supported. I've had it working using the non-64bit simulator, but not with the 64bit iPhone simulator. Your milage may vary. As per pix's comment below, Apple also seem to have removed mention of iOS simulator testing from their documentation.

like image 118
mluisbrown Avatar answered Oct 05 '22 23:10

mluisbrown


I do not believe you can test your purchases with the simulator.

From the "In-App Purchase Programming Guide":

Store Kit does not operate in iOS Simulator. When running your application in iOS Simulator, Store Kit logs a warning if your application attempts to retrieve the payment queue. Testing the store must be done on actual devices.

If you look at this link, Apple tells you about what you should do: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/DevelopingwithStoreKit/DevelopingwithStoreKit.html

You can also check out this link: restore button for in-app purchases error

Hope this helped!

like image 41
waylonion Avatar answered Oct 05 '22 22:10

waylonion