开发者

My Application Keeps Crashing And I Don't Know How To Fix It?

This is what comes up!

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 _runWi开发者_开发知识库thURL: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”.

How Can I Fix It?

This is my code

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

    }

}


Derek is correct, we will need more information to give you a full answer. However, this does point to a few places.

It looks like this is a crash during the startup of your app. Likely this is a problem with your main xib file, the default xib to be loaded as specified in your app's info.plist. (make sure that the correct xib is getting loaded.) Something is not connected properly, the class/connection combo doesn't exist, or the wrong class is attempting to get initialized. Check and make sure your class is correct in your xib and that the connections are set up properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜