delegate method throws runtime "unrecognized selector" error when switching back from one UIViewCont

Posted by chimgrrl on Stack Overflow See other posts from Stack Overflow or by chimgrrl
Published on 2010-06-09T05:18:01Z Indexed on 2010/06/09 5:22 UTC
Read the original article Hit count: 259

Ok, I've spend like half day on this and it's killing me.

So I've got 3 view controllers transitioning from one another, something like this:

I call the UploadDecisionViewController after destroying the previous View Controller:

[self dismissModalViewControllerAnimated:YES];
[self performSelector:@selector(showUDModalView) withObject:nil afterDelay:0.5];

In my showUDModalView method:

- (void)showUDModalView
{
    UploadDecisionViewController *udcontroller = [[UploadDecisionViewController alloc] initWithNibName:@"UploadDecisionViewController" bundle:nil];
    udcontroller.delegate = self;

    [self presentModalViewController:udcontroller animated:YES];
    [udcontroller release];

}

The UploadDecisionViewController shows up no problem. The UploadDecisionViewController has a button, which when clicked I want it to transition to the FileUploadViewController. I setup a UploadDecisionDelegate, threw a method in there to handle the button clicking:

Inside UploadDecisionDelegate protocol (UploadDecisionViewController.h):

@protocol UploadDecisionDelegate

//let UOnliveViewController know that a button was selected
- (void)UploadDecisionViewController:(UploadDecisionViewController *)controller madeChoice:(NSString *)whichDirection;
@end

Then inside my IBAction method when the button is clicked, I have this:

- (IBAction)decisionSelected:(id)sender
{

    [delegate UploadDecisionViewController:self madeChoice:@"upload"];//crashing at this line

}

When I run this, at this line above it is throwing a runtime exception:

2010-06-09 12:48:59.561 UOnlive[4735:207] *** -[UIView UploadDecisionViewController:madeChoice:]: unrecognized selector sent to instance 0x3b65420
2010-06-09 12:48:59.562 UOnlive[4735:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIView UploadDecisionViewController:madeChoice:]: unrecognized selector sent to instance 0x3b65420'
2010-06-09 12:48:59.563 UOnlive[4735:207] Stack: (
    33502299,
    2495698185,
    33884219,
    33453686,
    33306306,
    20618,
    2982917,
    3390286,
    3399023,
    3394235,
    3087839,
    2996168,
    3022945,
    40156505,
    33287040,
    33283144,
    40150549,
    40150746,
    3026863,
    11700,
    11554
)

Let me throw in the delegate method implemented also:

- (void)UploadDecisionViewController:(UploadDecisionViewController *)controller madeChoice:(NSString *)whichDirection
{
    NSLog(@"it got to here 245");
    [self dismissModalViewControllerAnimated:YES];
    if (yesOrNo) {
        //open up the FileUploadViewController and proceed to upload
        [self performSelector:@selector(showFUModalView) withObject:nil afterDelay:0.5];

    }
}

Can someone tell me what the heck is going on? Thanks a bunch for the help...

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiviewcontroller