Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[InAppMessaging] Firebase in-app message stuck at top and can't be dismissed on iOS 13+ #6803

Closed
antonjn opened this issue Oct 22, 2020 · 25 comments · Fixed by #7080
Closed
Assignees
Labels
api: inappmessaging Firebase In App Messaging

Comments

@antonjn
Copy link

antonjn commented Oct 22, 2020

Step 1: Describe your environment

Step 2: Describe the problem

  • UIWindow may get zero frame and misplace FIRIAMCardViewController on iOS 13+.
  • This happens on both device and Simulator on iOS 13 and iOS 14, but not on iOS 12 (and below).
  • This problem was introduced with the UIWindow.init(windowScene:) changes for iOS 13+.

Steps to reproduce:

  1. Make sure that an IAM will trigger when the app launches (in our case it's triggered when an event fires on the main view).
  2. Keep the app in foreground but start to put it in the background by swiping up just a little bit from the home indicator and keep your drag gesture when the IAM should be displayed.
  3. This will show the IAM on iOS 12 device/simulator but not work on iOS 13+ device/simulator. For the simulator on iOS 13+ the IAM window will have a zero frame and the FIRIAMCardViewController view frame is zero and on iOS 13+ devices the window will have a zero frame and the FIRIAMCardViewController view will be misplaced (in our case at the top of the screen).
  4. You can't interact with the IAM window at all and you can't dismiss the window either. The only way to get rid of it is to restart the app.

This can probably be reproduced in any project under the same basic conditions.

Possible Solution:

There is no reason to use the new UIWindow.init(windowScene:) on iPhone devices and should be reverted back to the old implementation using UIWindow.init(frame:).

IMG_3613  blurred
iOS 14 device (parts of the view removed from screenshot)

Screenshot 2020-10-22 at 15 10 22

iOS 13 simulator view debugger
@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.
@antonjn antonjn changed the title Firebase IAM (In App Message) stuck at top and can't be dismissed on iOS 13+ Oct 22, 2020
@antonjn antonjn changed the title Firebase In App Message stuck at top and can't be dismissed on iOS 13+ Oct 22, 2020
@morganchen12 morganchen12 added api: inappmessaging Firebase In App Messaging and removed needs-triage labels Oct 22, 2020
@antonjn
Copy link
Author

antonjn commented Oct 23, 2020

Nope the suggested solution using UIWindow.init(frame:) didn't work. At least not for me when building a custom version of the SDK (6.32.2) with the suggested fix. Maybe it's a iOS 13+ issue in some other way.

@antonjn
Copy link
Author

antonjn commented Oct 23, 2020

When I try this myself with a custom window it does not happen on iOS 12, 13 nor 14. So the problem seems to be with firebase!?, but I don't know what's going wrong.

I created a custom view controller and presented it in a window with

func presentInWindow() -> UIWindow {
    let window = UIWindow(frame: UIScreen.main.bounds)
    window.rootViewController = self
    window.windowLevel = .normal
    window.isHidden = false
    return window
}

I do keep a strong reference to the window while it's presented but firebase seems to do that as well (in a static property in FIRIAMRenderingWindowHelper.m)

My window is triggered from the same place as the firebaseAnalytics.logEvent("trigger", parameters: nil) event is triggered, but my window don't get the zero frame problem at all.

@Mattijah
Copy link

Mattijah commented Oct 24, 2020

We are also experiencing very similar issue with having the message view completely misplaced. I think this issue started happening just lately by itself.

Xcode version: 11.6
Firebase SDK version: 6.33.0
Firebase Component: InAppMessaging
Installation method: CocoaPods

  • On iPhone 8 (12.4) the message pops up correctly
  • On iPhone 8 ~13 (13.6) it is either misplaced or it doesn't get displayed at all and the console shows a constraint errors that you can find below.

Screenshot: (the white rectangle is a button with text in white colour, which doesn't actually reflect the settings in Firebase console correctly)
Screenshot 2020-10-24 at 19 21 25

Constraint errors:

2020-10-24 19:18:04.793598+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600000c47890 'Message Card View.centerX = centerX' message-card-view.centerX == UIView:0x7fa6714a1200.centerX   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c477f0 'Message Card View.leading = leadingMargin + 10' message-card-view.leading == UIView:0x7fa6714a1200.leadingMargin + 10   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c46ee0 'Title Label.leading = leading + 24' H:|-(24)-[UILabel:0x7fa67149fd60'$1000 Prize Pool']   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c46f30 'trailing = Title Label.trailing + 24' H:[UILabel:0x7fa67149fd60'$1000 Prize Pool']-(24)-|   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e6c0 'UIView-Encapsulated-Layout-Width' UIView:0x7fa6714a1200.width == 0   (active)>",
    "<NSLayoutConstraint:0x600000c47a70 'UIView-leftMargin-guide-constraint' H:|-(16)-[UILayoutGuide:0x6000016638e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x7fa6714a1200 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c46f30 'trailing = Title Label.trailing + 24' H:[UILabel:0x7fa67149fd60'$1000 Prize Pool']-(24)-|   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.794805+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600000c471b0 'Action Button.centerX = centerX' message-action-button.centerX == message-card-view.centerX   (active, names: message-action-button:0x7fa67148c920, message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47160 'Action Button.centerX = Title Label.centerX' message-action-button.centerX == UILabel:0x7fa67149fd60'$1000 Prize Pool'.centerX   (active, names: message-action-button:0x7fa67148c920 )>",
    "<NSLayoutConstraint:0x600000c47890 'Message Card View.centerX = centerX' message-card-view.centerX == UIView:0x7fa6714a1200.centerX   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c477f0 'Message Card View.leading = leadingMargin + 10' message-card-view.leading == UIView:0x7fa6714a1200.leadingMargin + 10   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c46ee0 'Title Label.leading = leading + 24' H:|-(24)-[UILabel:0x7fa67149fd60'$1000 Prize Pool']   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e6c0 'UIView-Encapsulated-Layout-Width' UIView:0x7fa6714a1200.width == 0   (active)>",
    "<NSLayoutConstraint:0x600000c47a70 'UIView-leftMargin-guide-constraint' H:|-(16)-[UILayoutGuide:0x6000016638e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x7fa6714a1200 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c47160 'Action Button.centerX = Title Label.centerX' message-action-button.centerX == UILabel:0x7fa67149fd60'$1000 Prize Pool'.centerX   (active, names: message-action-button:0x7fa67148c920 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.815738+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600000c47890 'Message Card View.centerX = centerX' message-card-view.centerX == UIView:0x7fa6714a1200.centerX   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c477f0 'Message Card View.leading = leadingMargin + 10' message-card-view.leading == UIView:0x7fa6714a1200.leadingMargin + 10   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e6c0 'UIView-Encapsulated-Layout-Width' UIView:0x7fa6714a1200.width == 0   (active)>",
    "<NSLayoutConstraint:0x600000c47a70 'UIView-leftMargin-guide-constraint' H:|-(16)-[UILayoutGuide:0x6000016638e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIView:0x7fa6714a1200 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c47890 'Message Card View.centerX = centerX' message-card-view.centerX == UIView:0x7fa6714a1200.centerX   (active, names: message-card-view:0x7fa6714a0740 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.817537+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<_UILayoutSupportConstraint:0x600000c39f40 _UILayoutGuide:0x7fa67148c560.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x600000c39ef0 V:|-(0)-[_UILayoutGuide:0x7fa67148c560]   (active, names: '|':UIView:0x7fa6714a1200 )>",
    "<NSLayoutConstraint:0x600000c47b60 'actual height at runtime' modal-image-view.height == 144   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c4d590 'Body Text View Height Constraint' message-body-textview.height == 100   (active, names: message-body-textview:0x7fa68192d000 )>",
    "<NSLayoutConstraint:0x600000c470c0 'Body Text View.top = Image View.bottom + 24' V:[modal-image-view]-(24)-[message-body-textview]   (active, names: message-body-textview:0x7fa68192d000, modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c46210 'Button Bottom To Container Bottom In Portrait Mode' V:[message-action-button]-(24)-|   (active, names: message-card-view:0x7fa6714a0740, message-action-button:0x7fa67148c920, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47200 'Button Top To Body Bottom Constraint' V:[message-body-textview]-(24)-[message-action-button]   (active, names: message-action-button:0x7fa67148c920, message-body-textview:0x7fa68192d000 )>",
    "<NSLayoutConstraint:0x600000c46fd0 'Image Top To Title Bottom In Portrait Mode' V:[UILabel:0x7fa67149fd60'$1000 Prize Pool']-(24)-[modal-image-view]   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c462b0 'Max Action Button Height' message-action-button.height == 36   (active, names: message-action-button:0x7fa67148c920 )>",
    "<NSLayoutConstraint:0x600000c477a0 'Message Card View.centerY = centerY' message-card-view.centerY == UIView:0x7fa6714a1200.centerY   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47840 'Message Card View.top \U2265 Top Layout Guide.bottom + 10' V:[_UILayoutGuide:0x7fa67148c560]-(>=10)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c46cb0 'Title Label Height Constraint' UILabel:0x7fa67149fd60'$1000 Prize Pool'.height == 34   (active)>",
    "<NSLayoutConstraint:0x600000c46e90 'Title Label.top = top + 24' V:|-(24)-[UILabel:0x7fa67149fd60'$1000 Prize Pool']   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e3a0 'UIView-Encapsulated-Layout-Height' UIView:0x7fa6714a1200.height == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c4d590 'Body Text View Height Constraint' message-body-textview.height == 100   (active, names: message-body-textview:0x7fa68192d000 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.819335+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<_UILayoutSupportConstraint:0x600000c39f40 _UILayoutGuide:0x7fa67148c560.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x600000c39ef0 V:|-(0)-[_UILayoutGuide:0x7fa67148c560]   (active, names: '|':UIView:0x7fa6714a1200 )>",
    "<NSLayoutConstraint:0x600000c47b60 'actual height at runtime' modal-image-view.height == 144   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c470c0 'Body Text View.top = Image View.bottom + 24' V:[modal-image-view]-(24)-[message-body-textview]   (active, names: message-body-textview:0x7fa68192d000, modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c46210 'Button Bottom To Container Bottom In Portrait Mode' V:[message-action-button]-(24)-|   (active, names: message-card-view:0x7fa6714a0740, message-action-button:0x7fa67148c920, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47200 'Button Top To Body Bottom Constraint' V:[message-body-textview]-(24)-[message-action-button]   (active, names: message-action-button:0x7fa67148c920, message-body-textview:0x7fa68192d000 )>",
    "<NSLayoutConstraint:0x600000c46fd0 'Image Top To Title Bottom In Portrait Mode' V:[UILabel:0x7fa67149fd60'$1000 Prize Pool']-(24)-[modal-image-view]   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c462b0 'Max Action Button Height' message-action-button.height == 36   (active, names: message-action-button:0x7fa67148c920 )>",
    "<NSLayoutConstraint:0x600000c477a0 'Message Card View.centerY = centerY' message-card-view.centerY == UIView:0x7fa6714a1200.centerY   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47840 'Message Card View.top \U2265 Top Layout Guide.bottom + 10' V:[_UILayoutGuide:0x7fa67148c560]-(>=10)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c46cb0 'Title Label Height Constraint' UILabel:0x7fa67149fd60'$1000 Prize Pool'.height == 34   (active)>",
    "<NSLayoutConstraint:0x600000c46e90 'Title Label.top = top + 24' V:|-(24)-[UILabel:0x7fa67149fd60'$1000 Prize Pool']   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e3a0 'UIView-Encapsulated-Layout-Height' UIView:0x7fa6714a1200.height == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c462b0 'Max Action Button Height' message-action-button.height == 36   (active, names: message-action-button:0x7fa67148c920 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.820878+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<_UILayoutSupportConstraint:0x600000c39f40 _UILayoutGuide:0x7fa67148c560.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x600000c39ef0 V:|-(0)-[_UILayoutGuide:0x7fa67148c560]   (active, names: '|':UIView:0x7fa6714a1200 )>",
    "<NSLayoutConstraint:0x600000c47b60 'actual height at runtime' modal-image-view.height == 144   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c470c0 'Body Text View.top = Image View.bottom + 24' V:[modal-image-view]-(24)-[message-body-textview]   (active, names: message-body-textview:0x7fa68192d000, modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c46210 'Button Bottom To Container Bottom In Portrait Mode' V:[message-action-button]-(24)-|   (active, names: message-card-view:0x7fa6714a0740, message-action-button:0x7fa67148c920, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47200 'Button Top To Body Bottom Constraint' V:[message-body-textview]-(24)-[message-action-button]   (active, names: message-action-button:0x7fa67148c920, message-body-textview:0x7fa68192d000 )>",
    "<NSLayoutConstraint:0x600000c46fd0 'Image Top To Title Bottom In Portrait Mode' V:[UILabel:0x7fa67149fd60'$1000 Prize Pool']-(24)-[modal-image-view]   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c477a0 'Message Card View.centerY = centerY' message-card-view.centerY == UIView:0x7fa6714a1200.centerY   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47840 'Message Card View.top \U2265 Top Layout Guide.bottom + 10' V:[_UILayoutGuide:0x7fa67148c560]-(>=10)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c46cb0 'Title Label Height Constraint' UILabel:0x7fa67149fd60'$1000 Prize Pool'.height == 34   (active)>",
    "<NSLayoutConstraint:0x600000c46e90 'Title Label.top = top + 24' V:|-(24)-[UILabel:0x7fa67149fd60'$1000 Prize Pool']   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e3a0 'UIView-Encapsulated-Layout-Height' UIView:0x7fa6714a1200.height == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c46cb0 'Title Label Height Constraint' UILabel:0x7fa67149fd60'$1000 Prize Pool'.height == 34   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.821688+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<_UILayoutSupportConstraint:0x600000c39f40 _UILayoutGuide:0x7fa67148c560.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x600000c39ef0 V:|-(0)-[_UILayoutGuide:0x7fa67148c560]   (active, names: '|':UIView:0x7fa6714a1200 )>",
    "<NSLayoutConstraint:0x600000c47b60 'actual height at runtime' modal-image-view.height == 144   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c470c0 'Body Text View.top = Image View.bottom + 24' V:[modal-image-view]-(24)-[message-body-textview]   (active, names: message-body-textview:0x7fa68192d000, modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c46210 'Button Bottom To Container Bottom In Portrait Mode' V:[message-action-button]-(24)-|   (active, names: message-card-view:0x7fa6714a0740, message-action-button:0x7fa67148c920, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47200 'Button Top To Body Bottom Constraint' V:[message-body-textview]-(24)-[message-action-button]   (active, names: message-action-button:0x7fa67148c920, message-body-textview:0x7fa68192d000 )>",
    "<NSLayoutConstraint:0x600000c46fd0 'Image Top To Title Bottom In Portrait Mode' V:[UILabel:0x7fa67149fd60'$1000 Prize Pool']-(24)-[modal-image-view]   (active, names: modal-image-view:0x7fa6714a08b0 )>",
    "<NSLayoutConstraint:0x600000c477a0 'Message Card View.centerY = centerY' message-card-view.centerY == UIView:0x7fa6714a1200.centerY   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47840 'Message Card View.top \U2265 Top Layout Guide.bottom + 10' V:[_UILayoutGuide:0x7fa67148c560]-(>=10)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c46e90 'Title Label.top = top + 24' V:|-(24)-[UILabel:0x7fa67149fd60'$1000 Prize Pool']   (active, names: message-card-view:0x7fa6714a0740, '|':message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e3a0 'UIView-Encapsulated-Layout-Height' UIView:0x7fa6714a1200.height == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c470c0 'Body Text View.top = Image View.bottom + 24' V:[modal-image-view]-(24)-[message-body-textview]   (active, names: message-body-textview:0x7fa68192d000, modal-image-view:0x7fa6714a08b0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.822788+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<_UILayoutSupportConstraint:0x600000c39f40 _UILayoutGuide:0x7fa67148c560.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x600000c39ef0 V:|-(0)-[_UILayoutGuide:0x7fa67148c560]   (active, names: '|':UIView:0x7fa6714a1200 )>",
    "<NSLayoutConstraint:0x600000c477a0 'Message Card View.centerY = centerY' message-card-view.centerY == UIView:0x7fa6714a1200.centerY   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47840 'Message Card View.top \U2265 Top Layout Guide.bottom + 10' V:[_UILayoutGuide:0x7fa67148c560]-(>=10)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e3a0 'UIView-Encapsulated-Layout-Height' UIView:0x7fa6714a1200.height == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c47840 'Message Card View.top ≥ Top Layout Guide.bottom + 10' V:[_UILayoutGuide:0x7fa67148c560]-(>=10)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.824429+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<_UILayoutSupportConstraint:0x600000c39f40 _UILayoutGuide:0x7fa67148c560.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x600000c39ef0 V:|-(0)-[_UILayoutGuide:0x7fa67148c560]   (active, names: '|':UIView:0x7fa6714a1200 )>",
    "<NSLayoutConstraint:0x600000c477a0 'Message Card View.centerY = centerY' message-card-view.centerY == UIView:0x7fa6714a1200.centerY   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c47cf0 'Message Card View.top \U2265 Top Layout Guide.bottom + 24' V:[_UILayoutGuide:0x7fa67148c560]-(>=24)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>",
    "<NSLayoutConstraint:0x600000c5e3a0 'UIView-Encapsulated-Layout-Height' UIView:0x7fa6714a1200.height == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c47cf0 'Message Card View.top ≥ Top Layout Guide.bottom + 24' V:[_UILayoutGuide:0x7fa67148c560]-(>=24)-[message-card-view]   (active, names: message-card-view:0x7fa6714a0740 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.827494+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600000c46cb0 'Title Label Height Constraint' UILabel:0x7fa67149fd60'$1000 Prize Pool'.height == - 43.2   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c46cb0 'Title Label Height Constraint' UILabel:0x7fa67149fd60'$1000 Prize Pool'.height == - 43.2   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-10-24 19:18:04.827805+0200 AppName[9248:14227304] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600000c4d590 'Body Text View Height Constraint' message-body-textview.height == - 124.8   (active, names: message-body-textview:0x7fa68192d000 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000c4d590 'Body Text View Height Constraint' message-body-textview.height == - 124.8   (active, names: message-body-textview:0x7fa68192d000 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
@antonjn
Copy link
Author

antonjn commented Oct 24, 2020

@Mattijah What's the size of the window frame? If it's zero, it's probably the same issue i have.

I get the WoT of breaking constraints too.

@Mattijah
Copy link

Mattijah commented Oct 24, 2020

@antonjn Yeah, it's zero. I think it was working ok like a week ago though... At least if I remember this correctly.

@Mattijah
Copy link

Mattijah commented Oct 26, 2020

@antonjn By reverting changes I've managed to find out what causes this issue on my side. When the app starts, I call InAppMessaging.inAppMessaging().triggerEvent("event_name") and at the same time I also register for notifications by calling notificationCenter.requestAuthorization(). Requesting authorization makes a UIAlertController appear at pretty much the same time as when Firebase tries to present its message too. Now, I don't know how is this stuff handled in Firebase, but as we can see there is a possibility of a conflict that is currently not handled correctly.

@christibbs
Copy link
Contributor

Thanks for the report. I'll dig into this later this week.

@christibbs
Copy link
Contributor

@antonjn Could you provide a video with the gesture described here? I'm not able to reproduce.

Keep the app in foreground but start to put it in the background by swiping up just a little bit from the home indicator and keep your drag gesture when the IAM should be displayed.
@antonjn
Copy link
Author

antonjn commented Oct 29, 2020

RPReplay_Final1603987443.mov.zip
iPhone XS with iOS 14.0.1

In the simulator it's not misplaced but gone entirely, but you can still see that the window is zero and you'll get a bunch of breaking constraint warnings if the debugger is attached.

@christibbs
Copy link
Contributor

I see. And is this message being triggered by a foreground, or a custom event that happens to fire at that time?

@antonjn
Copy link
Author

antonjn commented Oct 29, 2020

custom event

@Mattijah
Copy link

@christibbs I think the problem itself will most likely be somewhere else since I was having the exactly same issue without having to put the app in the background. Not sure how is this window/vc being presented and sized.

@antonjn
Copy link
Author

antonjn commented Oct 29, 2020

Well some users seem to have this issue when the app comes to foreground, not all the time, but sometimes. I think it's related to background/foreground state in some way. But as I wrote before. I didn't get this problem when I did a quick test presenting my own custom VC in a window, so it seems to be somewhat related to firebase's implementation from my point of view.

@Mattijah
Copy link

Yeah, definitely. Calling notificationCenter.requestAuthorization() for example, also puts the app in the Foreground Inactive state and if you try to present the IAM at this time, the issue occurs.

@antonjn
Copy link
Author

antonjn commented Nov 9, 2020

@christibbs Have you been able to reproduce this issue?

@fdelavra
Copy link

I have exactly the same problem using react native. I also have the request authorization but I tried to delete it and the problem persist

@christibbs
Copy link
Contributor

I wasn't able to reproduce this when I tried a week ago, but I'll get back on it since there are other reports.

@antonjn
Copy link
Author

antonjn commented Nov 16, 2020

  • Project was created pre iOS13 so no SceneDelegate only AppDelegate (which may be related this glitch).
  • The IAM displayed has an image that is fetched before IAM is displayed which takes some time (which may be related this glitch).
  • I get this issue both on device and in simulator. Window frame is zero where IAM is partially shown on device and not visible at all in simulator.
@christibbs
Copy link
Contributor

Ah, that might help. My tests have been on SceneDelegate apps.

@christibbs
Copy link
Contributor

Finally was able to repro this consistently. Working on it now.

@christibbs
Copy link
Contributor

I was able to fix @Mattijah's use case (triggering a system level alert at the same time as an in-app message) by using initWithFrame: instead of initWithWindowScene:. Seems reasonable enough to check for SceneDelegate vs AppDelegate and proceed accordingly.

@antonjn I still haven't reproduced your use case though. You mentioned it comes from swiping into background and back while using a custom trigger. What iOS lifecycle event are you firing the custom trigger from?

@antonjn
Copy link
Author

antonjn commented Nov 26, 2020

@christibbs

  1. Trigger IAM when the app starts (I do it through a custom event when the main view is visible after onboarding).
  2. IAM should include a fairly large image that takes some time to fetch (this may be irrelevant, or not).
  3. While the image is fetched you put the app in an inactive state.
    eg 1. swipe down notification center a little bit while your app is running in foreground.
    eg 2. by swiping up from the bottom of your phone a little like you're about put the app in the background, but you stop and hold that gesture (see the video I recoded above [InAppMessaging] Firebase in-app message stuck at top and can't be dismissed on iOS 13+ #6803 (comment)). It's easy (for me) to reproduce and happens 100% of the time when I do this.
@christibbs
Copy link
Contributor

@antonjn Please re-open this if the issue persists after this fix.

@antonjn
Copy link
Author

antonjn commented Dec 14, 2020

@christibbs Seems to have solved our problem! 🎉
Thx and great job! 😄

@firebase firebase locked and limited conversation to collaborators Jan 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: inappmessaging Firebase In App Messaging
6 participants