0

这是我的第一个 iPhone 应用程序,它基于顶级 tableview。行的选择要么转到另一个 tableview 要么转到一个视图。该应用程序在模拟器上运行正常,但是当移植到我的 iPhone 时,它​​会因 EXC_BAD_ACCESS 错误而失败。在显示我的启动画面时会发生这种情况。NSLog 表示 appDelegate.m 中的程序处理:

[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;

@结尾

appDelegate.m 代码.....

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

// Override point for customization after app launch    

[window addSubview:[navigationController view]];
[window makeKeyAndVisible];

}

4

1 回答 1

0

只是一个想法,在您的主要 Info.plist 文件中应该有一个Main nib file base name. 这是指应用程序启动时将加载的 nib。模拟器不区分大小写,但设备是。检查主笔尖值的大小写。

于 2009-12-12T11:33:47.130 回答