Appboy / appboy-ios-sdk

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

[Bug]: ABKUIUtils.activeWindowScene sometimes is wrong #351

Closed richard-ww closed 1 year ago

richard-ww commented 1 year ago

Platform

iOS

Platform Version

iOS 16.1

Braze SDK Version

4.5.1

Xcode Version

Xcode 14.1(14B47b)

Integration Method

Cocoapods

Computer Processor

Apple (M1)

Repro Rate

< 10%

Steps To Reproduce

  1. Turn on the iPhone's mirror feature and make it mirror to your TV
  2. Create a In-app message, MESSAGE TYPE = Modal, then send it to target user or device
  3. The In-app message was displayed on the TV, and because phones cannot click the close button on Modal, it remained displayed on the TV

Expected Behavior

It shouldn't show up on the TV, it should show up on the phone for me to click on

Actual Incorrect Behavior

It sometimes shows up on TV, and maybe once in 10 tries it will have this issue

Verbose Logs

No response

Additional Information

After debugging, I think the cause of the problem should be in the following code, two issues here:

  1. [self application].connectedScenes - all the state of the scene in the array does not meet the UISceneActivationStateForegroundActive
  2. Since the scene in the active state is not found and the last element of the array is taken directly, the scene belonging to the phone should be searched again

image

hokstuff commented 1 year ago

Hi @richard-ww,

Apologies for the late reply, and thanks for linking to the code in ABKUIUtils.m! It sounds like this issue has to do with the iPhone's mirror feature with a TV when displaying a modal in-app message. Are you experiencing this issue with other in-app message types?

I'm also curious if you are experiencing this issue when using our new Braze Swift SDK which has been written from scratch and may solve the issue you are facing. With the 5.8.0 release and the associated Appboy-iOS-SDK migration guide, the hope is that the migration to the new SDK should be smooth.

hokstuff commented 1 year ago

Are you still experiencing this issue?

hokstuff commented 1 year ago

I'm closing out this ticket due to inactivity. For others running into a similar issue, we recommend migrating to the Swift SDK which has completely rewritten logic for the UI layer.