urbanairship / ios-library

Urban Airship iOS SDK
http://urbanairship.com
Apache License 2.0
478 stars 265 forks source link

Banner in-app message view controller is not removed from parent view controller #395

Closed neriusv closed 7 months ago

neriusv commented 8 months ago

Preliminary Info

What Airship dependencies are you using?

18.0.1

What are the versions of any relevant development tools you are using?

Xcode 15.3

Report

What unexpected behavior are you seeing?

View controller of a banner in-app message is not removed from parent view controller after being dismissed.

What is the expected behavior?

View controller should be removed after dismissing the banner message.

What are the steps to reproduce the unexpected behavior?

  1. Send a banner in-app message;
  2. Dismiss the message;
  3. Inspect children of the root view controller: AirshipAutomation.InAppMessageBannerViewController is still present.

I believe the problem is at line 146 of AirshipLayoutDisplayAdapter.swift where viewController?.removeFromParent() is not called. The correct order should be

viewController?.willMove(toParent: nil)
viewController?.view.removeFromSuperview()
viewController?.removeFromParent()
viewController = nil

See Apple Developer documentation: [Remove a child view controller from your content](viewController?.removeFromParent())

Do you have logging for the issue?

n/a

crow commented 7 months ago

Thanks for the report - will get this fixed and released in the next patch.