braze-inc / braze-swift-sdk

Braze SDK for the Apple ecosystem, including: iOS, macOS, iPadOS, visionOS, tvOS
https://www.braze.com
Other
52 stars 19 forks source link

Braze.__allocating_init(configuration:) blocks main thread for 37.53ms on iPhone 12pro #111

Closed ashender closed 4 months ago

ashender commented 8 months ago

Platform

iOS

Platform Version

iOS 17

Braze SDK Version

6.6.0

Xcode Version

15.2

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

  1. run let braze = Braze(configuration: configuration) in the didFinishLaunching
  2. profile code with instruments

Expected Behavior

should not block or do it async

Actual Incorrect Behavior

blocks

Verbose Logs

No response

Additional Information

Can I run braze init on a background thread? this would solve issue Screenshot 2024-02-29 at 11 03 18 am

hokstuff commented 8 months ago

Hi @ashender,

Thanks for raising this issue. Can you file an issue with support@braze.com with more context around this including:

  1. Your full initialization code around Braze
  2. Any other relevant code that runs at initialization that may take a lot of time. This includes reading data from disk, complex logic occurring at startup, etc
  3. Any other dependencies in your app which may conflict with the Braze SDK
  4. Does this happen all the time, most of the time, or occasionally? And does it occur on both the simulator + devices?
  5. Usage notes that are specific for your app such as if it is generally used in low network environments, at high altitudes, or in other high stress situations that may interfere with the device's performance
  6. Whether or not this issue is present with the most recent version of the Braze SDK

Can I run braze init on a background thread? this would solve issue

We recommend against initializing Braze on a background thread because it may lead to unexpected behavior. For instance, push notifications may not function correctly if the set up methods don't run at the start of app launch.

Thanks!

lowip commented 4 months ago

Hi @ashender,

I'm closing this ticket due to inactivity, feel free to re-open it if you're still facing this issue.

Best,

senthilengg commented 1 month ago

@ashender Did you manage to fix this issue ? Our team is facing a similar one right now with the version 9.3.0