It's seems to be very tricky to test in-app purchases of a macOS app. This is what I've done:
- Defining two products with prodict identifiers in iTunesConnnct. Theyx are ready for submission.
- Creating a new version of the app linked to a new build and the said products.
- Closing the additional contract with Apple in iTunesConnect.
- Creating a sandbox user in iTunesConnect.
- Implementing the in-app store.
- Logging out from the app store on my developer machine.
- Building the app and starting the app in finder. The debug log should be a confirmation of the developer mode.
- Testing retrieving product information in the app successtully.
In several tests, sometimes the popup für a login into the app store appears. Sometimes the message "sandbox environement" was shown, mostly not. Last time the additional message was shown, that the user was't allowed to buy in the US store and login would be redirected to the national store. After this, nothing returned from the payment queue. In further tests, the popup doesn't appear any more and the payment queue doesn't return any event, even not an error.
This is, what I've checked:
- I checked, that there is nothing in a non persistant cache by restarting my developer machine.
- I checked, that the sandbox user still exists.
- I chacked, that the product identifiers are still valid.
- I checked, that the sandbox container and preferences are deleted by an Autormator script.
- I chacked, that my developer machine is connected to the USA by VPN, to avoid the redirect, that seems to make problems.
- I chacked, that the projects target was cleaned and the app rebuild.
- I checked, that the bundle identifier and version is the same as the version n the app store, that is linked to the products.
I have no more ides. Can someone help? Is there a way to reset the application? Maybe I missed to delte any persisted cache or receipt.
Thanks for your response. The xcarchive files are created by the organizer of Xcode for the archive. I have zipped the archive and dropped in into the trash and checked the in-app purchase again.
The behaviour of the system is quite similar. I could log in with the sandbox user and the following message is shown:
Account Not In This Store
Your account is not valid to use in the US store. You must switch to the German store before purchasing.
[Environment: Sandbox]
In this message the hint of the sandbox environment is shown, that is now shown in the login popup. If I click on "Change Store" the Store app openes with the message, that no access to the store could be established.
____________
I could manage so solve this issue with the following steps:
- Creating a sandbox user for the store area USA
- Deleting all app files in the Library folder with an Automator script
- Rebooting the developer machine to force a login promt for in-app purchases
- Cleaning and rebuilding the app for debugging.
- Startting the app in Finder
- Ignoring, that sanbox environment is not shown for the login.
This experience is maybe helpfull for other developers.