這是我的第一個iPhone應用程序,它基於頂級的tableview。行的選擇可以轉到另一個tableview或一個視圖。應用程序在模擬器上運行正常,但是當移植到我的iPhone時,它會失敗並顯示EXC_BAD_ACCESS錯誤。這發生在我的啓動畫面正在顯示。 NSLog表示程序在appDelegate.m中處理:tableview應用程序中的EXC_BAD_ACCESS
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
但是之後它只是失敗。該代碼似乎永遠不會到達我的RootViewController中的viewDidLoad。
我敢肯定,我已經有了RootViewController和appDelegates以某種方式混淆了,但無法弄清楚究竟出了什麼問題。我附上了我的RootViewController的開始代碼,appDelegate - 任何幫助表示讚賞。
RootViewController.h代碼....
@interface RootViewController : UITableViewController {
TyresViewController *tyresController;
EngineSpecViewController *engineSpecController;
CarbonTaxBandViewController *carbonTaxBandController;
TyreSpecificationsViewController *tyreSpecificationsController;
FuelConsumptionandEmissionsViewController *fuelConsumptionandEmissionsController;
CompanyCarTaxBandViewController *companyCarTaxBandController;
CarbonCalculatorViewController *carbonCalculatorController;
ReminderViewController *reminderController;
//NSString *selectedSpecification;
NSArray *listOfItems;
}
RootViewController.m代碼......
#import "RootViewController.h"
@implementation RootViewController
@synthesize listOfItems;
//@synthesize selectedSpecification;
@synthesize carbonTaxBandController;
@synthesize engineSpecController;
@synthesize tyreSpecificationsController;
@synthesize tyresController;
@synthesize fuelConsumptionandEmissionsController;
@synthesize companyCarTaxBandController;
@synthesize carbonCalculatorController;
@synthesize reminderController;
appDelegate.h代碼.....
@interface MyCar3AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UINavigationController *navigationController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@end
appDelegate.m代碼.....
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}