Xcode 12 StoreKit Configuration file not used by unit tests

Hello,

I have added a Xcode 12 StoreKit Configuration file (.storekit) so I can test purchases, and added it to the scheme for running my target in debug mode - the config file is working great when I run the application in an Xcode simulator.

However, I also have a suite of Xcode unit tests, and when I run those with an iOS 14 simulator it appears the StoreKit Configuration file is not active as all product requests for SKProduct fail. The requests all work normally in an iOS 13 simulator.

Is there somewhere else I need to enable a StoreKit Configuration file for unit tests specifically?

I tried adding an SKTestSession into a unit test initialized with the name of my StoreKit config but that did not help, as I'm not using the SKTestSession to make purchases but trying to trigger purchase mechanisms in my application itself. I also found some advice online to wait five seconds after launch and then it would work (???) but that didn't work for me either.

Replies

That is correct, if you want to use the StoreKit Configuration file for your tests then you will need to create and keep a reference to an SKTestSession. You don't need to interact with it other than creating it if you don't want to, but that is used to signal to the system to use the StoreKit testing in Xcode feature.

If you do that and are still having issues, can you please file feedback with a sample project of what you're using so that we can investigate any issues?