2012-03-24 5 views
0

바 컨트롤러 내 프로젝트 이름은 "AddDebtor"보기와 "Debtor"보기간에 전환하는 "DebtDevV1"입니다. 필자는 "탭 기반 응용 프로그램"을 기반으로 구축했습니다.main.m의 디버그 오류 EXC_BAD_ACCESS

내가 눌러 "DebtorViewController는"이 main.m 오류 메시지에 코딩 아래에서 중지 : 내가 DebtDevV1AppDelegate 내 커서를 할 때

프로그램 신호 "EXC_BAD_ACCESS"

을 받았다, 그것은 "Out of Scope"를 보여줍니다. 다음은

#import "DebtDevV1AppDelegate.h" 

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

인 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; 
} 

사람이 건너 또는 위의 오류에 대한 아이디어가 있습니까 : 아래

는 main.m입니까? 감사합니다.

+0

ARC를 사용하고 '자동 해제'를 제거하십시오. –

+0

dealloc 메서드는 어떻게 생겼습니까? – syclonefx

+0

죄송합니다. ARC가 무엇인지 알 수 있습니까? 또한 모든 [... autorelease] 코드를 제거해야한다는 뜻입니까? 또는 어떤 autorelease 제거 할 수 있습니까? –

답변

0

이것은 몇 달 전의 문제와 같습니다. dealloc 메소드를 확인하십시오. dealloc 메소드에서 마지막으로 호출 한 것이 [super dealloc]인지 확인하십시오. EXC_BAD_ACCESS crash when switching back and forth between views

+0

2 개의보기에서 2 .m 파일의 dealloc 메서드도 있어야합니까? 현재는 AppDelegate.m 파일에 dealloc 메서드 만 있습니다. –