Always prompted with Ask To Buy alert when purchasing in Sandbox environment

For the past few days, we've suddenly been unable to complete any purchases in the sandbox environment. The user is always prompted with the Ask To Buy alert and blocked from completing the purchase. Tapping the Ask option does not produce any notification to accept the purchase request either.


This occurs whether the logged-in iTunes user is an existing sandbox account with previous successful purchases or a brand new sandbox account.


Our app is an existing implementation of in-app purchase of subscriptions that's already deployed to the App Store and taking daily purchases. Going back to previous versions that have been tested successfully with in-app purchase exhibit the same Ask to Buy behavior as well.

We solved the issue.


Turns out for nearly a year now we had left the following flag set to true. Flipping it to false immediately allowed all purchases to go through.


SKMutablePayment.simulatesAskToBuyInSandbox = true


As noted in this post, simulatesAskToBuyInSandbox has not actually worked...until now. I am guessing that it was fairly recently fixed.


This explains why all previous versions of our app, known to have IAP working, were prompted with Ask To Buy as well while in sandbox.


Hopefully this saves someone some time.

Always prompted with Ask To Buy alert when purchasing in Sandbox environment
 
 
Q