iOS objc_msgSend crash, with no report or warning given

前端 未结 2 1847
独厮守ぢ
独厮守ぢ 2021-02-13 18:56

I am testing my app out, pushing it pretty hard, and I\'m getting it to crash (black screen, image doesn\'t save, drops back to springboard). However, I get no crash reports lo

2条回答
  •  攒了一身酷
    2021-02-13 19:43

    sometimes that happens when you set an object as an observer for notifications, like

    [[NSNotificationCenter defaultCenter] addObserver //details
    

    and don't remove it from the observers list when it's released.
    the system tries to send a message to it, and the app crashes because it's not there.

    try adding

    [[NSNotificationCenter defaultCenter] removeObserver:self];
    

    in the dealloc function.
    (even if you're working with arc, create a dealloc function, and write that in it).

    good luck

提交回复
热议问题