It’s important to thoroughly test your app before releasing it, and this includes any in-app transactions. To do this, you’ll need to create a dummy account in iTunes Connect under which to conduct your tests.
How To Test In-App Purchases on iOS Simulator?
1. Launch the iOS Simulator application.
2. Select the device you want to test on.
3. Select “In-App Purchases” in the “Features” list on the left side of the window.
4. Click the “Enable” switch at the top of the window.
5. Close the window by clicking the “X” in the top-left corner of the window.
6. In a new Finder window, navigate to and open your app’s sandbox folder.
7. Open the “Payments.plist” file in a text editor.
8. Add a new row to the “Payment Items” array and set its value to be an dictionary with the following keys:
– “type” (string) – The type of purchase this is, e.g., consumable, non-consumable, subscription, or entitlement
– “productIdentifier” (string) – The product identifier for this purchase
– “price” (float) – The price of this purchase
9. Save and close the file.
Troubleshoot In-App Test for iOS Simulator
1. In the Simulator, open the Settings app and select General > Restrictions.
2. Enable Restrictions if they are not already enabled, and set a passcode.
3. Under “Allowed Content”, enable In-App Purchases.
4. Close the Settings app and return to the Simulator.
5. Open the app you want to test in-app purchases in, and make sure you are logged in with an account that has permissions to make in-app purchases.
6. Tap the item you want to buy, and then tap the Buy button.
7. If prompted, enter your passcode.
8. If the purchase is successful, you will see a message saying “Your purchase was successful.”
How to Set Up a Test User for Your App in Apple App Store?
- Visit “Users and Access” in AppStore Connect after logging in.
- Select the “Sandbox Testers” menu item.
- Simply add a new tester by clicking the “+” button and filling out the form that appears.
- Select “Save” to keep your test results safe.
- If the user creation is successful, you will get a notification.
How to Put In-App Purchases to the Test with a User?
- To access the iTunes Store and your purchased apps, open the “Settings” app on your iOS device.
- When you choose the “Apple ID” button, a window will pop up.
- Exit your account by using the sign-out link.
- Start up the demo app and simulate a purchase.