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

后端 未结 2 1329
小鲜肉
小鲜肉 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:41

    Always for change at UI should be work on main thread. also an important subject is you can make an object from view at background thread!!! but for show in view or another changes on it just should be work on main thread, and this subject is main reason for occurrences this problem.

    finally for solve this problem you can easily use from 'DispatchQueue'

    DispatchQueue.main.async {
      // do your work
    }
    

提交回复
热议问题