是否还有其他人在新 iPhone X上停用应用程序时遇到applicationDidBecomeActive
错误触发的问题?
这是我的测试应用程序:
class ViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder:aDecoder)
NotificationCenter.default.addObserver(
self,
selector: #selector(fired),
name: .UIApplicationDidBecomeActive,
object: nil
)
}
@objc func fired(_:Any) {
print("fired")
}
}
在 iPhone X 模拟器上运行应用程序。自然,我在控制台中看到“解雇”。到现在为止还挺好。现在向侧面或向上滑动主页指示器,以切换到不同的应用程序或调出应用程序切换器。我看到控制台中再次出现“fired”!
这似乎是错误的,并且将我所有的应用程序都扔进了混乱中。我该如何应对在停用时收到激活通知?