Skip to content

Commit 7f55bc2

Browse files
authored
Merge pull request #704 from Flyclops/fix/unity_pause_ios
Fixed Unity not receiving lifecycle events from iOS
2 parents 799e0ca + 2a87c10 commit 7f55bc2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ios/Classes/UnityPlayerUtils.swift

+2-5
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ var sharedApplication: UIApplication?
170170
return
171171
}
172172

173-
let unityAppController = self.ufw?.appController as? UnityAppController
173+
let unityAppController = self.ufw?.appController() as? UnityAppController
174174
let application = UIApplication.shared
175175

176176
if notification?.name == UIApplication.willResignActiveNotification {
@@ -199,13 +199,10 @@ var sharedApplication: UIApplication?
199199
UIApplication.willEnterForegroundNotification,
200200
UIApplication.didReceiveMemoryWarningNotification
201201
] {
202-
guard let name = name as? String else {
203-
continue
204-
}
205202
NotificationCenter.default.addObserver(
206203
self,
207204
selector: #selector(self.handleAppStateDidChange),
208-
name: NSNotification.Name(name),
205+
name: name,
209206
object: nil)
210207
}
211208
}

0 commit comments

Comments
 (0)