Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
164 stars 142 forks source link

[Bug]: UI unresponsiveness if invoked on the main thread #354

Closed NikolasManiatis closed 1 year ago

NikolasManiatis commented 1 year ago

Platform

iOS

Platform Version

iOS 16.2

Braze SDK Version

4.5.2

Xcode Version

14.2

Integration Method

Cocoapods

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

Example:

  1. Add pod 'Appboy-iOS-SDK' to the Podspec file.
  2. Add Appboy.start( withApiKey: key, in: application, withLaunchOptions: launchOptions, withAppboyOptions: [ ABKInAppMessageControllerDelegateKey: self, ABKEnableAutomaticLocationCollectionKey: true, ABKEnableGeofencesKey: true ] ) Appboy.sharedInstance()?.inAppMessageController.inAppMessageUIController?.setInAppMessageUIDelegate?( self ) method in application:didFinishLaunchingWithOptions: method in AppDelegate.swift.
  3. Enable Location services
  4. Run the app.
  5. Accept the location services & re-run the app.

Expected Behavior

We should expect no warnings from Xcode regarding multithreading issues.

Actual Incorrect Behavior

Xcode presents a warning in the Issue Navigator that AppboyKit/AppboyKit/AppboyKit/Location/ABKLocationUtilities.m:29 This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the-locationManagerDidChangeAuthorization:callback and checkingauthorizationStatusfirst. The Xcode Issue Navigation will be attached here:

Screenshot 2023-01-19 at 12 56 00 PM

Verbose Logs

No response

Additional Information

No response

jerielng commented 1 year ago

Hi @NikolasManiatis, thanks for submitting this - we're looking into this and will get back to you with a resolution when we have all the details. Just to confirm, this is occurring upon initializing your Appboy session, correct?

Furthermore, if you are able to upgrade, our new Swift SDK has a dedicated library for location features and would have more robust handling in line with your request.

NikolasManiatis commented 1 year ago

Hi @jerielng, Yes its during the initialisation, it was introduced with iOS 16 SDK / Xcode 14. Apple seems to changed the way developers ask for the CLLocationManager.CLAuthorizationStatus but I have't looked into it deeply.

I will definitely check the Swift SDK and let you know!

jerielng commented 1 year ago

Hi @NikolasManiatis, we have just released version 4.5.3. of AppboyKit, which should resolve the warnings you're seeing in this instance.