tags:

views:

414

answers:

3

I have a very simple entry form. After a button is pressed, I need to show two additional views launched from that view. Here is the error. I am not understanding the error. I thought I had declared two different types. Comments appreciated.

009-11-03 17:17:29.008 eProcessing-iPhone[34257:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported ()'

Here is the code:

confirmViewController *anotherViewController = [[confirmViewController alloc] initWithNibName:@"confirmView" bundle:nil];

//set properties
anotherViewController.strConfirmation = [request responseString];
anotherViewController.strCardNumber = txtCardNumber.text;
anotherViewController.strExpires = txtExpires.text;
anotherViewController.strAmount = txtGrandTotal.text; 

[self.navigationController pushViewController:anotherViewController animated:YES];


//reset interface
if([anotherViewController.strApproval compare:@"""Y"] == NSOrderedSame)
{
 txtCardNumber.text = @"";
 txtExpires.text = @"";
 txtGrandTotal.text = @"";
 txtZip.text = @"";
 txtCCV2.text = @"";
 txtEmail.text = @"";
 txtInvoice.text = @"";
}

[anotherViewController release];


//show signature
sigCaptureViewController *yetAnotherViewController = [[sigCaptureViewController alloc] initWithNibName:@"sigCaptureView" bundle:nil];
[self.navigationController pushViewController:anotherViewController animated:YES];
[yetAnotherViewController release];
+1  A: 

Perhaps where you say

[self.navigationController pushViewController:anotherViewController animated:YES];

you mean

[self.navigationController pushViewController:yetAnotherViewController animated:YES];

The error is saying you can't have the same view controller on the navigation view stack twice.

Adam Wright
Thank you for the eyes.
jp chance
+1  A: 

You are pushing the same view controller twice:

[self.navigationController pushViewController:anotherViewController animated:YES];

The error is stemming from the fact that you're doing:

[anotherViewController release];

And then a few lines later you're doing:

[self.navigationController pushViewController:anotherViewController animated:YES];
richleland
A: 

Hi, I have the same problem , any good solution ?

marshluca