2012-03-24 7 views
0

バーコントローラ 私のプロジェクト名は、 "AddDebtor"と "Debtor"の表示を切り替える "DebtDevV1"です。私はそれを "タブベースのアプリケーション"に基づいて構築しました。デバッグエラーmain.c内のEXC_BAD_ACCESS

私は "DebtorViewController" を押すと、それは エラーメッセージmain.mでコーディング以下で停止:私はDebtDevV1AppDelegateに私にカーソルを置くとき

プログラムは、信号 "EXC_BAD_ACCESS"

を受けそれは"Out of Scope"を示します。

以下

main.mです:

以下
#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; 
} 

で誰もが遭遇するか、上記のエラーにアイデアを持っていますか? ありがとう!

+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メソッドしかありません –