这是我的第一个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];
}