我试图扫描我的内存泄漏的应用程序(基于窗口的用XIB1),但是当我跑步时有泄漏的工具应用程序,它具有异常崩溃下运行仪器应用程序时获得NSUnknownKeyException
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIWindow 0x4d20ec0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key rootViewController.'
奇怪的是,该应用在模拟器和设备上运行良好。
应用程序的委托代码:
#import "myAppDelegate.h"
@implementation myAppAppDelegate
@synthesize window;
@synthesize myController;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSLog(@"didFinishLaunchingWithOptions");
[window addSubview:myController.view];
[window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
}
- (void)applicationWillTerminate:(UIApplication *)application {
=}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end
更奇怪的是:UIWindow确实有一个'rootViewController'属性(自iOS 4.0开始)。 http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/occ/instp/UIWindow/rootViewController –
那么,这些信息如何对我有所帮助?我的项目中的UIWindow具有根控制器的出口。 – heximal