fix(ios): crash on ads after leaving the app (#3911)

This commit is contained in:
Olivier Bouillet 2024-06-20 11:18:27 +02:00 committed by GitHub
parent dc2a2ab863
commit 3d6bc9409c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -247,6 +247,11 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
} }
deinit { deinit {
#if USE_GOOGLE_IMA
_imaAdsManager.releaseAds()
_imaAdsManager = nil
#endif
NotificationCenter.default.removeObserver(self) NotificationCenter.default.removeObserver(self)
self.removePlayerLayer() self.removePlayerLayer()
_playerObserver.clearPlayer() _playerObserver.clearPlayer()
@ -1260,11 +1265,6 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
_resouceLoaderDelegate = nil _resouceLoaderDelegate = nil
_playerObserver.clearPlayer() _playerObserver.clearPlayer()
#if USE_GOOGLE_IMA
_imaAdsManager.releaseAds()
_imaAdsManager = nil
#endif
self.removePlayerLayer() self.removePlayerLayer()
if let _playerViewController { if let _playerViewController {