0

bar controller, My project name is "DebtDevV1", which switch between view "AddDebtor" and "Debtor". I built it based on the "tabbed based application".

When i press "DebtorViewController", it stopped at below coding in main.m Error message:

Program received signal "EXC_BAD_ACCESS"

When i put my cursor on DebtDevV1AppDelegate, it shows "Out of Scope".

Below is the main.m:

#import "DebtDevV1AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([DebtDevV1AppDelegate class]));
    }
}

Below is the DebtDevV1AppDelegate.m

#import "DebtDevV1AppDelegate.h"
#import "AddDebtorViewController.h"
#import "DebtorViewController.h"

@implementation DebtDevV1AppDelegate

@synthesize window = _window;
@synthesize tabBarController = _tabBarController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    UIViewController *viewController1 = [[[AddDebtorViewController alloc] initWithNibName:@"AddDebtorViewController" bundle:nil] autorelease];
    UIViewController *viewController2 = [[[DebtorViewController alloc] initWithNibName:
    @"DebtorViewController" bundle:nil] autorelease];
    self.tabBarController = [[[UITabBarController alloc] init] autorelease];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    return YES;
}

Does anyone come across or have idea on above error? Thanks!

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
Tsui John
  • 107
  • 3
  • 21

1 Answers1

0

This sounds like the same problem I had a few months ago. Check your dealloc methods. Make sure [super dealloc] is the last call you make in the dealloc method. EXC_BAD_ACCESS crash when switching back and forth between views

Community
  • 1
  • 1
syclonefx
  • 2,830
  • 1
  • 21
  • 24
  • should i have dealloc methods in the 2 .m files in the 2 views also? currently i only have dealloc method in AppDelegate.m file – Tsui John Mar 28 '12 at 15:07