From 2a87c1035f062d878221847ca685d096efcbcacc Mon Sep 17 00:00:00 2001 From: Jake O'Brien Date: Thu, 27 Oct 2022 15:24:35 -0400 Subject: [PATCH] fixed casting bugs that were prevening unity receiving ios lifecycle events --- ios/Classes/UnityPlayerUtils.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ios/Classes/UnityPlayerUtils.swift b/ios/Classes/UnityPlayerUtils.swift index ef055942..315e525a 100755 --- a/ios/Classes/UnityPlayerUtils.swift +++ b/ios/Classes/UnityPlayerUtils.swift @@ -170,7 +170,7 @@ var sharedApplication: UIApplication? return } - let unityAppController = self.ufw?.appController as? UnityAppController + let unityAppController = self.ufw?.appController() as? UnityAppController let application = UIApplication.shared if notification?.name == UIApplication.willResignActiveNotification { @@ -199,13 +199,10 @@ var sharedApplication: UIApplication? UIApplication.willEnterForegroundNotification, UIApplication.didReceiveMemoryWarningNotification ] { - guard let name = name as? String else { - continue - } NotificationCenter.default.addObserver( self, selector: #selector(self.handleAppStateDidChange), - name: NSNotification.Name(name), + name: name, object: nil) } }