Crash when pushing to another controller after `didFinishPickingMediaWithInfo`

蓝咒 提交于 2019-12-02 12:46:23

The primary cause of your issue is that you are trying to access the outlets of the view controller too soon. The view controller's views and outlets are not created and assigned immediately after instantiating the view controller.

It's also poor design to attempt to directly access the views of a view controller from code outside of that view controller. The proper solution, in this case, is to add a UIImage property that you can set. Then let the view controller update its own image view based on the value of that image property at the proper time (such as in viewDidLoad).

add this to your function

dismiss(animated:true, completion: nil)

In the completion, you can define a closure that does whatever you want.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!