[英]crash when launching the application
i have made a UIViewController (LoadingViewController) which is the first view to be displayed after the didFinishLaunching
and it will hold a UIProgressView later, and then the user is redirected to the MenuView (MenuViewController), however i have got crash when i build and run the application : 我已经制作了一个UIViewController(LoadingViewController),这是在didFinishLaunching
之后显示的第一个视图,它将在稍后保存UIProgressView,然后用户被重定向到MenuView(MenuViewController),但是当我构建和运行时我遇到了崩溃应用程序 :
2011-05-07 23:03:29.673 MyApp[2442:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MyAppAppDelegate 0x6b4e550> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key viewController.'
*** Call stack at first throw:
(
0 CoreFoundation 0x0291d919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x027325de objc_exception_throw + 47
2 CoreFoundation 0x0291d851 -[NSException raise] + 17
3 Foundation 0x000acc2b _NSSetUsingKeyValueSetter + 135
4 Foundation 0x000acb99 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x00526d0a -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x02893b6f -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x00525721 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x005274b5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x003369bb -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x0033790d -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 198
11 UIKit 0x00341452 -[UIApplication handleEvent:withNewEvent:] + 1958
12 UIKit 0x0033a074 -[UIApplication sendEvent:] + 71
13 UIKit 0x0033eac4 _UIApplicationHandleEvent + 7495
14 GraphicsServices 0x02e97afa PurpleEventCallback + 1578
15 CoreFoundation 0x028fedc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x0285f737 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x0285c9c3 __CFRunLoopRun + 979
18 CoreFoundation 0x0285c280 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x0285c1a1 CFRunLoopRunInMode + 97
20 UIKit 0x00337226 -[UIApplication _run] + 625
21 UIKit 0x00342b58 UIApplicationMain + 1160
22 MyApp 0x00002d10 main + 102
23 MyApp 0x00002ca1 start + 53
)
terminate called after throwing an instance of 'NSException'
the stack show that the reason is from MyAppAppDelegate
file. 堆栈显示原因来自MyAppAppDelegate
文件。 here is my relevant code : LoadingViewController.h : 这是我的相关代码: LoadingViewController.h :
#import <UIKit/UIKit.h>
#import "MenuViewController.h"
@interface LoadingViewController : UIViewController {
IBOutlet MenuViewViewController *menuViewController;
}
@end
LoadingViewController.m :
#import "LoadingViewController.h"
@implementation LoadingViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)dealloc {
[super dealloc];
}
@end
the MyAppAppDelegate.h : MyAppAppDelegate.h:
#import <UIKit/UIKit.h>
@class LoadingViewController;
@interface MyAppAppDelegate : NSObject <UIApplicationDelegate,CLLocationManagerDelegate> {
UIWindow *window;
LoadingViewController *loadingView;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet LoadingViewController *loadingView;
@end
the MyAppAppDelegate.m : MyAppAppDelegate.m:
#import "MyAppAppDelegate.h"
#import "LoadingViewController.h"
@implementation MyAppAppDelegate
@synthesize window;
@synthesize loadingView;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[window addSubview:loadingView.view];
[window makeKeyAndVisible];
return YES;
}
- (void)dealloc {
[loadingView release];
[window release];
[super dealloc];
}
@end
thx in advance for the help :)
I don't think you posted the relevant code. 我认为您没有发布相关代码。 You only include the dealloc methods and you say it crashes on startup, so the code you posted is never run. 您只包含dealloc方法,并且说它在启动时崩溃,因此您发布的代码永远不会运行。
2011-05-07 23:03:29.673 MyApp[2442:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MyAppAppDelegate 0x6b4e550> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key viewController.'
Judging from the thrown exception it seems like you're using an invalid key, namely viewController
, to set a value on your app delegate. 从抛出的异常判断,你似乎正在使用一个无效的键,即viewController
,在你的app委托上设置一个值。 The problem as far as I can tell is that you haven't declared a viewController
property. 据我所知,问题是你还没有声明一个viewController
属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.