user1162056
user1162056

Reputation:

Error while navigation

When I navigate to another view controller with y=this two lines it works ok.

  Inventory *obj = [[Inventory alloc] initWithNibName:@"Inventory" bundle:nil]; 
  [self.navigationController pushViewController:obj animated:YES];

But if i write this line [Which we must write]

[obj release];

It gives me bad access error.

Pls help.

Thanks

Upvotes: 0

Views: 58

Answers (2)

tassar
tassar

Reputation: 588

Inventory *obj = [[[Inventory alloc] initWithNibName:@"Inventory" bundle:nil] autorelease]

Upvotes: 1

Nitin Gohel
Nitin Gohel

Reputation: 49730

your object of class was Released then it access again that object who already released so you got this bad access error. please read this following link Article for Understanding EXC_BAD_ACCESS

Upvotes: 1

Related Questions