Question

Are RevenueCat callbacks always on a background thread?

  • 13 October 2023
  • 2 replies
  • 55 views

Badge +2

Hi all,

I’m setting up subscriptions with RevenueCat and I noticed that `[RCPurchases.sharedPurchases customerInfoWithCompletionHandler:^(RCCustomerInfo * _Nullable info, NSError * _Nullable error) {` will have the completion handler called  a background thread. Is this intended? Are all RevenueCat callbacks on background threads?

 

Do I need to always run `dispatch_async(dispatch_get_main_queue()` after a RevenueCat API?


Thanks!


2 replies

Userlevel 1
Badge +5

Hello!

That’s not at all intended, so thanks for reporting this. We try to make sure that all our completion blocks are called on the main thread to make the SDK easier to use. However, we can’t fully guarantee this 100% until we’re able to switch to using `@MainActor` everywhere, which we can’t until we drop support for iOS 12.

To help us look into this issue, could you share a few more details with us?

  • SDK version
  • Xcode version
  • Verbose logs (Purchases.logLevel = .verbose)

Thank you!

Badge

Is there anyway to push this to the background at startup? The main thread gets blocked for an insanely long time on startup and impacts performance

Reply