Hi, I’m new to RC and this forum. I’ve searched but couldn’t find anything definitive on this topic but if there is, please let me know…
Is there a way in StoreKit 2 (and in extension, in the RevenueCat SDK) to get an unique identifier for the current iCloud ID or user? I'm a bit worried about this part in the SDK docs:
If you don't provide an App User ID when instantiating the Purchases SDK, RevenueCat will generate a new random App User ID for you and cache it on the device. In the event that the user deletes and reinstalls the app, a new random App User ID will be generated.
I guess my question is: do I have to force the current user to sign in with their Apple ID if I want to prevent the quoted behavior?
Edit: Or did I overthink everything again — maybe I should ignore the iCloud ID for my iOS/macOS-only app, and just rely on the RC-provided anonymous App User ID and the restoring purchases mechanism…?
Best answer by YousefView original
No, even if they are signed in with their Apple ID, the SDK will assign the current user an anonymous App User ID (a unique identifier prefixed with
$RCAnonymousID:) if a custom App User ID is not provided by the developer. Custom App User IDs are typically provided by your app’s own authentication system. The major benefit of custom App User IDs is that it allows users to access their subscription status across platforms when they login to your auth system. It looks like the following,
customerInfoin the SDK regardless of what platform the user is on
If you are not relying on your own authentication system for this cross-platform functionality, then each user will be assigned an anonymous App User ID when the SDK is configured. If a user for some reason (new device etc.) is logged out of their anonymous App User ID when accessing the app and a different anonymous App User ID is assigned on configure, then they will need to press a restore button, which will grant that new ID access to the current Store (App Store, Play Store) user’s purchases. How that works in detail is determined by the restore behavior that is selected for you project.
I hope this clears things up!