Manual unwind segue from UIImagePickerController fails with 'Receiver has no segue with identifier'

自闭症网瘾萝莉.ら 提交于 2019-12-12 04:48:14

问题


I've almost finished converting a large Universal app to use Storyboards, but have one issue that is stumping me. I have created a Scene for a custom UIImagePickerController, but I can't figure out how to unwind from it. I know I could just dismiss the controller, but I want to use the unwind process to pass the image back to the original source view controller. When I try to do the manual unwind, I get the following exception:

'NSInvalidArgumentException', reason: 'Receiver (<MyImagePickerController: 0x7facdb838000>) has no segue with identifier 'unwindPickImage''

I think it is interesting that the crash log shows a call to

[UIViewController shouldPerformSegueWithIdentifier:sender:]

but if I implement that method in the MyImagePickerController class, it does not get called. Also, it is interesting that at the time of the crash, the view controller's _storyboardSequeTemplates private property is nil, but they are visually present in IB.

I have uploaded a demo project to Github that demonstrates this error and also several unwind segue patterns that I have used successfully elsewhere in the project to communicate between view controllers. Is is possible to use a manual unwind segue from a UIImagePickerController rather than using the old delegate pattern to return the image? If so, how? Thanks.

来源:https://stackoverflow.com/questions/26364690/manual-unwind-segue-from-uiimagepickercontroller-fails-with-receiver-has-no-seg

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