I have noticed strange behavior for UIApplication.willResignActiveNotification on different devices/simulators. It seems that iPhone 15 Pro (both simulator and device) is calling callback twice for willResignActiveNotification on lock action. Example:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(testCallback), name: UIApplication.willResignActiveNotification, object: nil)
}
@objc func testCallback() {
// this message will be printed 2 times on iPhone 15 Pro with a small delay
print("[willResignActiveNotification]")
}
}
And it works as expected on other devices (e.g. iPhone 15). I also noticed that it only reproduces on iOS 17, so it's probably a system bug. I'll report it to Apple. Is anyone else experiencing this problem?