playsrg-apple
playsrg-apple copied to clipboard
Message banners incorrectly retain view controllers
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:
- Play some content.
- Toggle the show favorite state.
- Close the player (with a pull down) while the notification is displayed.
- 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.
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.
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.