Xcode给了我错误"实例成员' pauseGame322'不能用于类型' ViewController&#39 ;;你的意思是使用这种类型的值吗?"
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
ViewController.pauseGame322(ViewController)
}
答案 0 :(得分:1)
尝试在视图控制器中添加观察者
NotificationCenter.default.addObserver(self,
selector: #selector(applicationWillTerminate),
name: .UIApplicationWillTerminate,
object: nil)
回调
@objc func applicationWillTerminate() {
self.pauseGame322()
}