//发送KVO通知
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "work_number"), object: nil);
//监听KVO通知
NotificationCenter.default.addObserver(self, selector: #selector(listenerWorkNumber), name:NSNotification.Name(rawValue: "work_number"), object: nil);
///监听用户进入首页将工号穿来
@objc func listenerWorkNumber() {
UIApplication.shared.registerForRemoteNotifications();
}
网友评论