0

アプリケーションに iAds を実装しようとしていますが、次のようになります。

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 exceptionPreprocess + 185 1 libobjc.A.dylib
0x02bd840e objc_exception_throw + 47 2 CoreFoundation
0x02a8NSa[ doesNotRecognizeSelector:] + 187 3
CoreFoundation
0x029fa2b6 __ forwarding
+ 966 4
CoreFoundation
0x029f9e72 _CF_forwarding_prep_0 + 50 5 Vampire Quiz Final
0x000027a2 -[Vampire_Quiz_FinalViewController viewDidLoad] + 601 6 UIKit
ビュー 0x003715ca]
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_FUNC_CALLING_FORMSOUT_CALLING_ + 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、これの合成もセッターとゲッターも表示されません。.h ファイルでプロパティを作成しましたbannerIsVisibleか?

このクラッシュを解決するには、ヘッダーでプロパティを定義し、実装に @synthesize ステートメントを追加する必要があります。


プロパティ、シンセサイザー、コンパイラの警告 (1 つあるはずです)、デバッグなどの基本的なことを理解するために、より基本的なことから始める必要があるかもしれません。
失礼なことは言いたくないのですが、理解できないコピーされたコードを使用しても、多くを学ぶことはできません。

于 2010-11-06T09:53:06.927 に答える
0

認識できないセレクターがインスタンスに送信されました: これは、そのクラスのメソッドが見つからないことを意味します。クラスの実装を確認してください。

于 2010-11-06T07:41:27.907 に答える