Crash in actionForLayer:forKey:

后端 未结 2 1497
说谎
说谎 2021-01-04 09:54

I have a cryptic EXC_BAD_ACCESS when changing some UILabel\'s frame. The crash is random, usually I have to repeat the conditions for several minutes.

Enabling NSZom

相关标签:
2条回答
  • 2021-01-04 10:21

    This crash has non-main threads that appear to use UIKit classes or functions. Generally speaking, it is only safe to use UIKit from the main thread. Calling into UIKit from background threads can cause unpredictable behavior (like crashes!). Please double check that all of your code (that is not on the main thread) has been explicitly marked as safe to use in the background by Apple.

    External resources:

    UIKit Framework Reference

    0 讨论(0)
  • 2021-01-04 10:25

    You probably already checked for this, but it's worth shot...

    Are you certain that you aren't doing anything that would effect any UI elements in a background thread? Perhaps you're doing some computation related to this search and it changes a property of some view.

    I have seen his sort of thing in cases where I forgot a performSelectorOnMainThread:withObject:waitUntilDone: call and then altered the UI in the background.

    0 讨论(0)
提交回复
热议问题