remirobert / Dotzu

:iphone::eyes: In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.
MIT License
1.8k stars 141 forks source link

crash on background thread #32

Closed johndpope closed 7 years ago

johndpope commented 7 years ago
screen shot 2017-05-19 at 12 51 33 pm

I updated a PINCache sample gist here https://gist.github.com/johndpope/1dd3663a8712bb1901536a44bccd6a5a

johndpope commented 7 years ago

It seems to be reproducible in my code base under obscure edge case in background thread. code below is woven across different classes. In any case - this is the fragility of nsarchiver / threading.

let kFixStatusButtonColorOnCloseButtonPress = NSNotification.Name("kFixStatusButtonColorOnCloseButtonPress")

// Class that is being torn down.
// ClassA.VC
   override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        Notificator.fireNotification(named: kFixStatusButtonColorOnCloseButtonPress)
    }

// ClassB.VC
    func addObserverForStatusBarFixOnFilterClose(){
        NotificationCenter.default.addObserver(self, selector: #selector(resyncStatusBarColor), name: kFixStatusButtonColorOnCloseButtonPress, object: nil)
    }

    override func resyncStatusBarColor(){
//        Logger.verbose("resyncStatusBarColor") <- BOOM

    }
johndpope commented 7 years ago

this is unrelated to my bug.