Xcode 12 introduced StoreKit Configuration files which are great for testing basic StoreKit functionality before delving into App Store Connect, Sandbox and all that.
Is there a way to determine at run-time (or even at compile-time) whether the scheme's StoreKit Configuration
value is set to 'none' or some file?
I was just wondering the same, because since I perform local receipt validation, I had to use the right certificate: StoreKit or Apple's root.
The solution is pretty simple: add a new product inside your .storekit file to check if you are using the local config or the sandbox/App Store one.
Add a new product ID called using_store_kit_conf then pass the array of IDs to
SKProductsRequest
containing also this one. When you get the list of products in the delegate, check if the using_store_kit_conf product is present to determine if you're using the StoreKit Configuration file.If you list all your products to the user, remember to filter out the using_store_kit_conf product.
Sample:
Pass all the IDs:
Delegate:
Check if using StoreKit Configuration:
NOTE: This only works after you have loaded the products list, otherwise
isUsingStoreKitConfiguration
will always return false.