قالب وردپرس درنا توس
Home / IOS Development / willEnterBackgroundNotification called twice (Swift): iOSProgramming

willEnterBackgroundNotification called twice (Swift): iOSProgramming



When I run I get "Get into the foreground", written twice in the console

     override func viewDidLoad () {
// Add alert observers
NotificationCenter.default.addObserver (self, selector: #selector (willEnterForeground), name: UIApplication.willEnterForegroundNotification, object: null
}

@objc func willEnterForeground () {
print ("comes into the foreground")
}

Source link