This is for iOS. I'm using in-app purchases in my React Native app, and I use the following code:
IAP.initConnection()
.catch((e) => {
throwError(`Error connecting to the in-app purchase store: ${e}`)})
.then(async () => {
await IAP.getPurchaseHistory()
.catch(e => throwError(`Errors fetching purchase history: ${e}`))
.then(async (receipt) => {
validate(receipt)
});
});
If I'm not already signed into a sandbox account Apple ID, calling IAP.getPurchaseHistory prompts the user to sign in. If I do, then IAP.getPurchaseHistory() always throws an error.
Has anyone encountered this?