Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unwind two segues

Definition of (the relevant part in) my app:

I have map in my view (MAP). User clicks a view, app reverse geocodes to get the address and segues to another view (PICKER), it lets user select from picker the name she wants for the place or go to another view and give custom name (CUSTOM).

Storyboard of the app

Problem is that when I try to unwind from CUSTOM it fails.

In custom I unwind to the same method as from PICKER that I have in MAP's controller i.e.

@IBAction func unwindCancel(segue:UIStoryboardSegue) {
    // do nothing as saving was cancelled
    return
}

@IBAction func unwindSave(segue:UIStoryboardSegue) {
    self.reloadGeodesics()
}

Below I present how I made in the storyboard the unwinding, i.e. ctrl drag Cancel (and Save) to exit and select corresponding Action segue.

This is my action segue

These are my error messages

2015-11-02 14:58:59.753 via[19620:2883125] -[via.LocationNamePickerViewController unwindSave:]: unrecognized selector sent to instance 0x7bb35770

2015-11-02 14:58:59.789 via[19620:2883125] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[via.LocationNamePickerViewController unwindSave:]: unrecognized selector sent to instance 0x7bb35770'

when I click save. via is my app name and LocationNamePickerViewController is the controller of PICKER. I have looked many tutorials and to me I seem to be doing everything right.

Is this a problem of doing the segue from clicking Other in PICKER to CUSTOM wrongly? Does the navigation controller between the MAP and PICKER crash the compiler? From the error it looks like PICKER's controller cannot delegate the action segue call to the MAP's controller. Can this happen and if it happens how can it be fixed? Everything works fine in the PICKER, the problem is just with unwinding the CUSTOM.

like image 448
Antti Avatar asked Oct 30 '22 16:10

Antti


1 Answers

The way you create unwind segue is not right,you should create segue like this

Control + drag from Location Enter VC to Map Exit

Gif

like image 183
Leo Avatar answered Nov 06 '22 03:11

Leo