Question

Where to Configure RevenueCat When Using Custom User Ids?


Badge +4

Docs say not to configure RevenueCat in -application:didFinishLaunchingWithOptions: when using custom user ids since iOS 15+ prewarming. Instead configure in your root view controller’s initialization method. Which ‘initialization’ method is that? The +initialization factory method, or the -init instance method?

 

 https://www.revenuecat.com/docs/user-ids#provide-app-user-id-on-configuration

 

Provide App User ID on configuration

 

❗️

iOS 15+ Prewarming

In certain cases, iOS may prewarm your app - this essentially means your app will be launched silently in the background to improve app launch times for your users.

If you are not using RevenueCat's anonymous IDs as described above, and are instead providing your own app user ID on configuration, do not call configure in application:didFinishLaunchingWithOptions:. Instead, call the configure method in your root view controller's initialization method.

 


3 replies

Badge +4

Digging deeper, the above RevenueCat information appears to be in conflict with Apple’s documentation. 

 

https://developer.apple.com/documentation/uikit/app_and_environment/responding_to_the_launch_of_your_app/about_the_app_launch_sequence?language=objc

 

 

Apple says that prewarming executes an app’s launch sequence up until, but not including, when main() calls UIApplicationMain. This means that prewarming doesn’t reach the -application:willFinishLaunchingWithOptions: delegate method, and so configuring RevenueCat in this delegate method should be okay whether or not using anonymous or custom user ids.

 

Am I missing something or is RevenueCat’s documentatio here incorrect?

 

 

Userlevel 4
Badge +6

Hey @Dalmazio,

 

I do recommend following our documentation to set up your project correctly. 

❗️iOS 15+ PrewarmingIn certain cases, iOS may prewarm your app - this essentially means your app will be launched silently in the background to improve app launch times for your users.If you are not using RevenueCat's anonymous IDs as described above, and are instead providing your own app user ID on configuration, do not call configure in application:didFinishLaunchingWithOptions:. Instead, call the configure method in your root view controller's initialization method.

We call this out because when calling configure with defined app user ID’s you will want to know those ID's when configuring so in this case you would configure on launch when the correct app User ID’s are set. 

 

I hope this helps! 

Userlevel 4
Badge +6

I got some more information on this topic, we recommend calling configure in the view controller's viewDidLoad method. viewDidLoad sidesteps everything as that is called only when the app is actually launched by a user tapping the app's icon 

 

More information about this could be found here https://stackoverflow.com/questions/44579445/what-is-viewdidload-for

Reply