我不知道什麼是錯的語句,因爲我有完全是我從我的另一個項目複製相同的代碼,但它只是不斷拋出EXC_BAD_ACCESS時,一切看起來不錯。任何人都可以指出問題嗎?非常感謝,因爲我一直在這個錯誤數小時,相同的代碼不斷產生不同的結果,如不良訪問或我得到一個白色的屏幕。EXC_BAD_ACCESS問題發佈聲明
的代碼片段:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
NSLog(@"0");
UINavigationController * localNavigationController;
tabBarController = [[UITabBarController alloc] init];
NSMutableArray * localControllersArray = [[NSMutableArray alloc] initWithCapacity:4];
//ProductViewController
ProductViewController * productViewController;
productViewController = [[ProductViewController alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController: productViewController];
[localControllersArray addObject:localNavigationController];
NSLog(@"1");
// memory statements
[localNavigationController release];
[productViewController release];
//Search View Controller
SearchViewController * searchViewController;
searchViewController = [[SearchViewController alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController: searchViewController];
[localControllersArray addObject:localNavigationController];
// memory statements
[localControllersArray release];
[searchViewController release];
NSLog(@"2");
//Register View Controller
RegisterViewController * registerViewController;
registerViewController = [[RegisterViewController alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:registerViewController];
[localControllersArray addObject:localNavigationController];
NSLog(@"3");
//memory management
[localControllersArray release];
[registerViewController release];
//About View Controller
AboutViewController * aboutViewController;
aboutViewController = [[AboutViewController alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController: aboutViewController];
[localControllersArray addObject:localNavigationController];
//memory management
[localNavigationController release];
[aboutViewController release];
NSLog(@"4");
// Override point for customization after application launch.
tabBarController.viewControllers = localControllersArray;
[window addSubview:tabBarController.view];
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
return YES;
的NSLog的是看到了這個問題。 3 [localNavigationController發佈]後不顯示。
我重視這個項目。
http://www.mediafire.com/?eauye5s361cyej0
在此先感謝。
怎麼樣的代碼片段呢? – Eimantas 2011-05-16 08:26:50
對不起,我不打算下載並解壓縮整個項目,然後猜測錯誤的位置。請在問題中張貼一些代碼。 – JeremyP 2011-05-16 08:29:33