0

This is my first post here.

I'm a newbie to the iPhone SDK. Please answer my question even if it is simple. I've created a navigation based application. The hierarchy as follows:

NavigationController - RootViewController - ATableViewController (pushed over RootViewController)

On RootViewController first I've pushed ATableViewController. Then, I'm presenting a view controller with TabBarController (which has four tabs each having its own navigation controller).

Now I want to keep two buttons on each navigation controller. On clicking one it should dismiss the modal view controller and on clicking the other it should return to RootViewController.

So, I've kept button on the UINavigationBar to dismiss the modal view controller. However on dismissing it I'm receiving an error:

*** -[CALayer superlayer]: message sent to deallocated instance 0xb157840

the backtrace is:

#0  0x011bb657 in ___forwarding___ ()
#1  0x011bb522 in __forwarding_prep_0___ ()
#2  0x004c54e5 in _UIConvertDisplayPointToWindow ()
#3  0x004c5695 in +[UIWindow _hitTestToPoint:pathIndex:forEvent:] ()
#4  0x004a5709 in _UIApplicationHandleEvent ()
#5  0x01cf8992 in PurpleEventCallback ()
#6  0x0122b944 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#7  0x0118bcf7 in __CFRunLoopDoSource1 ()
#8  0x01188f83 in __CFRunLoopRun ()
#9  0x01188840 in CFRunLoopRunSpecific ()
#10 0x01188761 in CFRunLoopRunInMode ()
#11 0x01cf71c4 in GSEventRunModal ()
#12 0x01cf7289 in GSEventRun ()
#13 0x004aac93 in UIApplicationMain ()
#14 0x00001cd9 in main (argc=1, argv=0xbffff678) at main.m:14

Anyone please please help me out. I'm struggling with this problem from two weeks. I've spent many hours googling it.

Any help is greatly appreciated.

Thanks for reading.

Max MacLeod
  • 26,115
  • 13
  • 104
  • 132
  • You are sending a message to an object that no longer exists. But, it is impossible to truly answer this question as is. Please show us the code you use to dismiss the controller, and if possible, tell us the line that it crashes at. You can find the line by setting a breakpoint and then stepping through line by line until it crashes. – sosborn Dec 14 '11 at 08:00
  • Usually you get the exec_bad_access error when you release an instance that shouldn't be released, so by providing some code I guess you can get a better help. – Mousa Dec 14 '11 at 08:03
  • In my opinion, this crash log is not sufficient. As you are accessing a variable that has been already deallocated, this crash is happening. Check which variable (CALayer) you are accessing. – Ilanchezhian Dec 14 '11 at 08:04
  • This is how i'm presenting the view having tabbarcontroller [self.navigationController presentModalViewController:pdvc animated:YES]; Its is crashing in main function here i'm dismissing the controller -(IBAction)backToResults:(id)sender { NSLog(@"GO back to results"); [self dismissModalViewControllerAnimated:YES]; } – user1097298 Dec 14 '11 at 08:13
  • Hi everyone, I've a simple doubt. Can I Push a TabBarController on to navigation stack?? – user1097298 Dec 14 '11 at 09:06

1 Answers1

1

Check on this post how to set NSZombieEnabled. That will show more details on crashes that should help you debug your issue :

App crash only on iPhone Device and not in Simulator

Community
  • 1
  • 1
Niko
  • 2,543
  • 1
  • 24
  • 29