RevenueCat / purchases-ios

In-app purchases and subscriptions made easy. Support for iOS, watchOS, tvOS, macOS, and visionOS.
https://www.revenuecat.com/
MIT License
2.37k stars 319 forks source link

macOS App hanging for at least 2000 ms because of check for macOS app running on the main thread. #3871

Open jb-apps opened 6 months ago

jb-apps commented 6 months ago

Describe the bug A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

  1. Environment
    1. Platform: macOS
    2. SDK version: 4.40.1
    3. StoreKit version:
      • [ ] StoreKit 1
      • [x] StoreKit 2 (enabled with usesStoreKit2IfAvailable(true))
    4. OS version: Sonoma 14.1.1
    5. Xcode version: 15.3
    6. Device and/or simulator:
      • [x] Device
      • [ ] Simulator
    7. Environment:
      • [ ] Sandbox
      • [ ] TestFight
      • [x] Production
    8. How widespread is the issue. Percentage of devices affected. 100% users.
  2. Debug logs that reproduce the issue. Complete logs with Purchases.logLevel = .verbose will help us debug this issue.
All good in debug, it only happens in production and in the App Store.
  1. Steps to reproduce, with a description of expected vs. actual behavior
    • Create a new macOS project.
    • Add revenueCat framework.
    • Set environment to prod.
    • Need to fiddle a little bit with the revenueCat SDK to make sure MapAppStoreDetector is called.

App hangs at status = SecStaticCodeCheckValidity

Screenshot 2024-05-06 at 22 28 15

It throws the following warning when running locally:

Screenshot 2024-04-22 at 15 37 56
  1. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.) Problem seems to be related to this code status = SecStaticCodeCheckValidity running on the main thread.

  2. Additional context It only happens on the App Store.

RCGitBot commented 6 months ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

aboedo commented 6 months ago

@jb-apps thanks for reporting! We'll get it fixed

aboedo commented 3 months ago

Sorry it took so long, but the fix is merged and will be a part of next release!