0

我一直在尝试在我的应用程序中实施 iAd,但这就是发生的情况:

1.点击应用程序2.加载屏幕显示几秒钟3.应用程序崩溃

这是返回的内容:

2010-11-06 20:19:11.043 Vampire Quiz Final [99722:207] Interface Builder 文件中的未知类 AdViewController。2010-11-06 20:19:11.066 Vampire Quiz Final[99722:207]-[Vampire_Quiz_FinalViewController setBannerIsVisible:]:无法识别的选择器发送到实例 0x761c710 2010-11-06 20:19:11.409 Vampire Quiz Final[99722: 207由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,

原因:'-[Vampire_Quiz_FinalViewController setBannerIsVisible:]:无法识别的选择器发送到实例 0x761c710' *第一次抛出调用堆栈:( 0 CoreFoundation
0x02a88b99异常预处理 + 185 1 libobjc.A.dylib
0x02bd840e objc_exception_throw + 47 2 CoreFoundation
0x02a [NSaObjectab)8 doesNotRecognizeSelector:] + 187 3
CoreFoundation
0x029fa2b6 __转发
+ 966 4
CoreFoundation
0x029f9e72 _CF_forwarding_prep_0 + 50 5 Vampire Quiz Final
0x000027a2 -[Vampire_Quiz_FinalViewController viewDidLoad] + 601 6 UIKit [UIKit
0x0031771ca]
0x000021b1 -[Vampire_Quiz_FinalAppDelegate application:didFinishLaunchingWithOptions:] + 74 8 UIKit 0x002c7f27 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163 9 UIKit 0x002ca3b0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346 10 UIKit 0x002d43ec -[ UIApplication handleEvent:withNewEvent:] + 1958 11 UIKit
0x002ccb3c -[UIApplication sendEvent:] + 71 12 UIKit 0x002d19bf _UIApplicationHandleEvent + 7672 13 GraphicsServices
0x03368822 PurpleEventCallback + 1550 14 CoreFoundation
0x02a69ff4 CFRUNLOOP_IS_C + 52 15 CoreFoundation 0x029ca807 __CFRunLoopDoSource1 + 215 16 CoreFoundation
0x029c7a93 __CFRunLoopRun + 979 17 CoreFoundation
0x029c7350 CFRunLoopRunSpecific + 208 18 CoreFoundation
0x029c7271 CFRunLoopRunInMode + 97 19 UIKit
0x002c9c6d -[UIApplication _run] + 625 20 UIKit
0x002d5af2 UIApplicationMain + 1160 21 Vampire Quiz Final
0x00002144 main + 102 22 Vampire Quiz Final 0x000020d5 start + 53 ) 在抛出一个 'NSException' sharedlibrary apply-load-rules all (gdb) 实例后调用终止

PS 我是 iPhone 开发新手

谢谢

这是我的代码:

@implementation Vampire_Quiz_FinalViewController

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

    }

}



@end

我该如何解决?

4

2 回答 2

1

您正在使用self.bannerIsVisible,但我既看不到合成器,也看不到 setter 和 getter。bannerIsVisible您是否在 .h 文件中 创建了一个属性?

要解决此崩溃,您应该在标题中定义属性并在您的实现中添加 @synthesize 语句。


也许你应该从更基础的东西开始,以了解基本的东西,比如属性、合成器、编译器警告(应该有)、调试等等。
我不想变得粗鲁,但是通过使用你不理解的复制代码你不会学到很多东西。

于 2010-11-06T09:53:06.927 回答
0

无法识别的选择器发送到实例:这意味着找不到该类的方法。检查类实现。

于 2010-11-06T07:41:27.907 回答