Tuesday, March 12, 2024
HomeiOS Developmentios - 'UIApplicationWillResignActiveNotification' calling twice for a number of devicessimulators

ios – ‘UIApplicationWillResignActiveNotification’ calling twice for a number of devicessimulators


I’ve observed unusual habits for UIApplication.willResignActiveNotification on totally different gadgets/simulators. Plainly iPhone 15 Professional (each simulator and system) is asking callback twice for willResignActiveNotification. Instance:

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        tremendous.viewDidLoad()
        
        NotificationCenter.default.addObserver(self, selector: #selector(testCallback), identify: UIApplication.willResignActiveNotification, object: nil)
    }
    
    @objc func testCallback() {
        // this message will likely be printed 2 occasions on iPhone 15 Professional with a small delay
        print("[willResignActiveNotification]")
    }
}

And it really works as anticipated on different gadgets (e.g. iPhone 15). I additionally observed that it
solely reproduces on iOS 17, so it is in all probability a system bug. I will report it to Apple.
Is anybody else experiencing this drawback?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments