I am developing an application and using in-app purchases in it. i have created in-app products in iTunes Connect. till yesterday everything was working fine. but today. it started giving this error.
“Error: Payment requests are restricted to products returned as valid via Store Kit’s didRecieveResponse method.”
i have no idea what is the issue. please reply
Ok, This may be the smoking gun —
According to the official dataflow from the Store Kit apps, you are supposed to retrieve information about the available purchases (SKProductsRequest) before trying to make a purchase (SKPaymentQueue).
I added code to do just that, even though the localized data wasn’t being used. I made the call, verified the item was present, and just dumped an NSLOG about it.
The purchase went through, with no errors!
I then removed the code that called SKProductsRequest, and re-ran it, and got the “Payment requests are restricted…” error message.
It almost seems like the store kit framework was changed in such a way as to REQUIRE you to make a call to SKProductsRequest, in order for purchases to behave correctly when tehy are added to SKPaymentQueue.
In computer science speak, they seem to have introduced a hard dependence between the two logically related, but separate modules. This is a REALLY bad practice.
Try adding this code into your app, and call dumpProductInfo at some point prior to making “real” calls to SKPaymentQueue and see if it starts working — be sure to update the embedded string literal with your actual product identifier(s).
Follow-up: as mentioned below, Apple Technical Note QA1691 confirms that what I thought was happening was correct — two weeks after we figured it out :p