注册通知
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "AuthSuccessNotification"),object: nil)
监听通知
NotificationCenter.default.addObserver(self,selector:#selector(ViewController.pageJump),name: NSNotification.Name(rawValue: "AuthSuccessNotification"),object: nil)
销毁通知
deinit {
NotificationCenter.default.removeObserver(self)
}
- deallco方法改成了deinit
- 一定要注意线程问题