qonversion / react-native-sdk

React Native SDK for cross-platform in-app purchase and subscription infrastructure, revenue analytics, engagement automation, and integrations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with syncHistoricalData

Orange9000 opened this issue · comments

Hello. We're using react-native-qonversion 4.4.2

We're calling Qonversion.getSharedInstance().syncHistoricalData() after module initialization. For some reason, it causes an apple login prompt to appear on a simulator, as well as on some real devices (App is downloaded from Testflight. One device so far). Cancelling this prompt results in Qonversion.getSharedInstance().checkEntitlements() failing with error (checkEntitlements is called later, after Qonversion module init and syncHistoricalData). Devices obviously have a logged in Apple ID user.

Example error from xCode logs after login prompt is dismissed:
❌ Historical data sync failed: The operation couldn’t be completed. (SKErrorDomain error 2.)

Is this expected behaviour? Would this prompt appear when the app is in production?

Screenshot 2023-07-11 at 09 27 13

Apparently, this window appears to users which have no linked payment method associated with their Apple ID.
Nonetheless, this shouldn't happen, since syncHistoricalData runs for every user and I've no way of checking if they have a linked payment method.

Hi, @Orange9000
It's expected behavior. syncHistoricalData is an analog of the restore function you should have in your app following Apple guidelines. And in some cases, Apple may show that prompt and ask for the user credentials. When you call syncHistoricalData, we check that this logic wasn't called yet for the current user and process it. Otherwise, we skip it. If you don't want to sync historical data, you can skip calling that function and let the user tap restore when they want. Unfortunately, avoiding that window is impossible because the logic that decides to show it or not is on the Apple side.

Hi, @Orange9000 It's expected behavior. syncHistoricalData is an analog of the restore function you should have in your app following Apple guidelines. And in some cases, Apple may show that prompt and ask for the user credentials. When you call syncHistoricalData, we check that this logic wasn't called yet for the current user and process it. Otherwise, we skip it. If you don't want to sync historical data, you can skip calling that function and let the user tap restore when they want. Unfortunately, avoiding that window is impossible because the logic that decides to show it or not is on the Apple side.

Thank you for your reply. This is what we decided to go with. syncHistoricalData will be manual for iOS users. For android users it will stay automatic and ran on app launch.