Error when dismissing view controller

前端 未结 6 1703
时光取名叫无心
时光取名叫无心 2021-02-07 07:52

Getting an error when dismissing a view controller, not seen anything like it before, and not much about it on the internet.

heres the error: * Assertion failur

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 08:03

    I recieved this error when I was calling -presentViewController:animated:completion: on a thread that was not the main thread (from a callback in a network request). The solution is to dispatch your calls to present and dismiss view controllers to the main thread:

    dispatch_async(dispatch_get_main_queue(), ^{
        //Code that presents or dismisses a view controller here
    });
    

提交回复
热议问题