这就是出现的问题!
2010-11-08 16:37:54.269 Vampire Quiz Final[5492:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x7619c40> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** Call stack at first throw:
(
0 CoreFoundation 0x02a87b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02bd740e objc_exception_throw + 47
2 CoreFoundation 0x02a87ad1 -[NSException raise] + 17
3 Foundation 0x0003e0f3 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0003e061 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004bc70a -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x029fdd0f -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004bb121 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004bceb5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x002c8402 -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x002c931c -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 198
11 UIKit 0x002d33ec -[UIApplication handleEvent:withNewEvent:] + 1958
12 UIKit 0x002cbb3c -[UIApplication sendEvent:] + 71
13 UIKit 0x002d09bf _UIApplicationHandleEvent + 7672
14 GraphicsServices 0x03367822 PurpleEventCallback + 1550
15 CoreFoundation 0x02a68ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x029c9807 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x029c6a93 __CFRunLoopRun + 979
18 CoreFoundation 0x029c6350 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x029c6271 CFRunLoopRunInMode + 97
20 UIKit 0x002c8c6d -[UIApplication _run] + 625
21 UIKit 0x002d4af2 UIApplicationMain + 1160
22 Vampire Quiz Final 0x00001d56 main + 84
23 Vampire Quiz Final 0x00001cf9 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
我该如何解决?
这是我的代码
.h:
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>;
@interface Vampire_Quiz_FinalViewController : UIViewController <ADBannerViewDelegate>
{
ADBannerView *adView;
BOOL bannerIsVisible;
}
@property (nonatomic,assign) BOOL bannerIsVisible;
-(IBAction)V;
-(IBAction)A;
-(IBAction)I;
@end
的.m:
#import "Vampire_Quiz_FinalViewController.h"
#import "Q1ViewController.h"
#import "Vork.h"
#import "About.h"
#import "Instructions.h"
@implementation Vampire_Quiz_FinalViewController
@synthesize bannerIsVisible;
- (IBAction)V;
{
Vork *V = [[Vork alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:V animated:NO];
}
- (IBAction)A;
{
About *A = [[About alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:A animated:NO];
}
- (IBAction)I;
{
Instructions *I = [[Instructions alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:I animated:NO];
}
- (void)dealloc {
[super dealloc];
}
- (void)viewDidLoad {
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, -50);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[self.view addSubview:adView];
adView.delegate=self;
self.bannerIsVisible=NO;
[super viewDidLoad];
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
// banner is invisible now and moved out of the screen on 50 px
banner.frame = CGRectOffset(banner.frame, 0, 50);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// banner is visible and we move it out of the screen, due to connection issue
banner.frame = CGRectOffset(banner.frame, 0, -50);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
答案 0 :(得分:1)
Derek是对的,我们需要更多信息才能给你一个完整的答案。但是,这确实指向了一些地方。
在您的应用启动期间,这似乎是一次崩溃。可能这是您的主xib文件的问题,默认的xib将按照应用程序的info.plist中的指定加载。 (确保正在加载正确的xib。)某些内容未正确连接,类/连接组合不存在,或者错误的类正在尝试初始化。检查并确保您的类在xib中正确并且连接已正确设置。