Question

I have a custom class written for a custom segue animation. I am trying to custom animate a tap gesture. In my storyboard I have a Navigation Controller, the main view, and then two other views. Ive connected the gesture to the other view, and defined the custom class for the segue to use but I get the error below. I have another segue using just Push that works fine. Any ideas on what im doing wrong?

This is my class:

- (void) perform {

    UIViewController *src = (UIViewController *) self.sourceViewController;
    UIViewController *dst = (UIViewController *) self.destinationViewController;

    [UIView transitionWithView:src.navigationController.view duration:0.8
                       options:UIViewAnimationOptionTransitionFlipFromBottom
                    animations:^{
                        [src.navigationController pushViewController:dst animated:NO];
                    }
                    completion:NULL];

}

Error:

2012-02-20 16:04:45.889 IdeaStarters[2755:fe03] -[__NSCFDictionary setView:]: unrecognized selector sent to instance 0x6a40010
2012-02-20 16:04:45.891 IdeaStarters[2755:fe03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setView:]: unrecognized selector sent to instance 0x6a40010'
*** First throw call stack:
(0x13ba052 0x154bd0a 0x13bbced 0x1320f00 0x1320ce2 0x4fc3e 0x922f40 0x922eeb 0x50268 0x93dd60 0x3f8c54 0x3f8c8f 0x13bbe1a 0x1325821 0x22f46e 0xd6e2c 0xd73a9 0xd75cb 0xd7941 0xe947d 0xe966f 0xe993b 0xea3df 0xea561 0x2064ca 0x50301 0x13bbe72 0x1d6492d 0x1d6e827 0x1cf4fa7 0x1cf6ea6 0x1cf6580 0x138e9ce 0x1325670 0x12f14f6 0x12f0db4 0x12f0ccb 0x12a3879 0x12a393e 0x11a9b 0x2abd 0x2a25 0x1)
terminate called throwing an exception(lldb) 
Was it helpful?

Solution

You may find it helpful to always set this symbolic breakpoint.

https://github.com/brennanMKE/Interfaces/blob/master/NSAssertBreakpoint.png

That breakpoint will automatically stop the Debugger and give you a chance to go back up the call stack to see where the problem started.

I use NSAssert often to verify state before calling anything.

NSAssert([segue.destinationViewController isKindOfClass:[ABExpectedClass class]], @"Destination VC must be ABExpectedClass");

I recall having a problem like this but the selector it was trying to call was not from within in my code and normally calling something on a nil value should not be a problem. I was just doing something wrong and the assertions I used helped me correct the logic.

Try checking out other custom segues on GitHub. There are many out there that you can use as reference.

https://github.com/search?q=UIStoryboardSegue&ref=commandbar

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top