Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread

后端 未结 2 1326
小鲜肉
小鲜肉 2021-02-15 08:23

I am getting this crash after converting an existing UIViewController to Auto Layout and I can\'t figure out what is causing it. I did search for dispatch_asy

2条回答
  •  清歌不尽
    2021-02-15 08:48

    I finally found out the problem after taking another look at the stack trace. The problem was that I was changing the value property of a UISlider instance on a background thread.

    But nowhere does it state that you have to change it on the main thread! (Thanks, Apple) Apparently, it seems like UISlider implements the value's setter and forces a layout or something similar.

提交回复
热议问题