playsrg-apple icon indicating copy to clipboard operation
playsrg-apple copied to clipboard

Message banners incorrectly retain view controllers

Open defagos opened this issue 5 years ago • 2 comments

The SwiftMessages banner retains the parent view controller context, if any has been defined, while it is displayed.

This is easy to see with our media player view controller:

  1. Play some content.
  2. Toggle the show favorite state.
  3. Close the player (with a pull down) while the notification is displayed.
  4. The sound continues in the background for a few seconds, matching the display duration of the notification.

After having briefly looked at the SwiftMessages source code (nothing we do could lead to this behavior), version 7.0.0, it appears that view controllers should be weakly referenced. There is probably an issue with the implementation. We should fix it as a PR.

defagos avatar Jun 06 '19 09:06 defagos

An app-side fix has been made in commit 2a31e9843a098e2af470373d2cb8d889c0b21e8c.

Still, we can try fixing the issue in SwiftMessages, which would be helpful for other projects as well.

defagos avatar Jun 07 '19 08:06 defagos

The app fix does not work, the view controller is still retained during dispatch_after. This issue has already been reported to SwiftMessages and needs to be fixed there.

defagos avatar Feb 17 '20 07:02 defagos