I am getting
Type of expression is ambiguous without more context
on the following lines:
NotificationCenter.default.addObserver(self, selector: #selector(willResignActive), name: .UIApplication.willResignActiveNotification , object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(openedAgain), name: .UIApplication.didBecomeActiveNotification, object: nil)
What is the correct syntax?
remove the . on UIApplication.willResignActiveNotification.
Your line should look like this:
NotificationCenter.default.addObserver(self, selector: #selector(willResignActive), name: UIApplication.willResignActiveNotification , object: nil)