UIScrollView EXC_BAD_ACCESS crash in iOS SDK

前端 未结 9 1664
暖寄归人
暖寄归人 2020-12-24 11:49

I have an iPhone SDK application that has several views that appear and disappear as the user creates content. After using the application on a device for a while, I get th

9条回答
  •  清歌不尽
    2020-12-24 12:16

    I just worked through this problem myself.

    I had an issue where:

    • A scrollview delegate was wired to a UIViewController
    • The scrollview began animating
    • The delegate went away and dealloc was called.

    The problem was the scrollview delegate messages were firing on a new-deallocated object, and the crash logs were a bit confusing as they were pointing to nonsensical object references.

    The fix was to set the scrollview delegate to nil as the first line of my view controller dealloc method.

    Hope this helps someone else!

提交回复
热议问题