Skip to main content
Question

Are RevenueCat callbacks always on a background thread?

  • Oct 13, 2023 9:41 PM UTC
  • 2 replies
  • 405 views

Forum|alt.badge.img+4

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!

This post has been closed for comments

2 replies

NachoSoto
Forum|alt.badge.img+5
  • Active Helper
  • Oct 17, 2023 5:39 PM UTC

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!


Forum|alt.badge.img+1
  • New Member
  • Mar 5, 2024 3:26 AM UTC

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