I've just installed XCode6 Beta-7 and am now seeing an access exception on one of my PrepareForSegue methods - (called when a Modal Segue is about to unwind)
The code in question looks like this:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "MY_IDENTIFIER") { //EXC_BAD_ACCESS (code=1, address=0x0)
//Never gets here...
}
}
I've tried making the segue parameter an optional but as far as Swift is concerned, segue
is not nil, so even with a check like the below, I have the same failure...
override func prepareForSegue(segue: UIStoryboardSegue?, sender: AnyObject!) {
if (segue != nil)
if (segue!.identifier == "MY_IDENTIFIER") { //EXC_BAD_ACCESS (code=1, address=0x0)
//Never gets here...
}
}
}
All other segues in the application seem to work fine, but this one is failing - and it seems to occur only in the case of an unwind being issued. Anyone else encountered this?
EDIT / Workaround
A simple workaround is to avoid using the unwindSegue method and simply call dismissViewControllerAnimated
, but I'd still love to know why the unwindSegue method is failing in this instance...
Many thanks!