From 3d6bc9409c2111760620a821466b0ea0f1970681 Mon Sep 17 00:00:00 2001 From: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:18:27 +0200 Subject: [PATCH] fix(ios): crash on ads after leaving the app (#3911) --- ios/Video/RCTVideo.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index e7c73e8e..25bae29d 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -247,6 +247,11 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH } deinit { + #if USE_GOOGLE_IMA + _imaAdsManager.releaseAds() + _imaAdsManager = nil + #endif + NotificationCenter.default.removeObserver(self) self.removePlayerLayer() _playerObserver.clearPlayer() @@ -1260,11 +1265,6 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH _resouceLoaderDelegate = nil _playerObserver.clearPlayer() - #if USE_GOOGLE_IMA - _imaAdsManager.releaseAds() - _imaAdsManager = nil - #endif - self.removePlayerLayer() if let _playerViewController {