2010-11-06 99 views
0

我一直在努力實現的iAds到我的應用程序,但是這是發生了什麼:嘗試實施iAd後,我的應用程序無法打開!

上應用 2.Loading屏幕顯示1.Tap了幾秒鐘 3.App崩潰

這是什麼返回:

2010-11-06 20:19:11.043吸血鬼測驗 最終[99722:207]未知類 AdViewController在界面生成器 文件。 2010-11-06 20:19:11.066吸血鬼 測驗最終[99722:207] - [Vampire_Quiz_FinalViewController setBannerIsVisible:]:無法識別 選擇發送到實例0x761c710 2010-11-06 20:19:11.409吸血鬼測驗 最終[ 99722:207] *終止應用程序 由於未捕獲的異常 'NSInvalidArgumentException' 的,

原因: ' - [Vampire_Quiz_FinalViewController setBannerIsVisible:]:無法識別 選擇發送到實例0x761c710' *鈣(0 CoreFoundation
0x02a88b99 exceptionPreprocess + 185 1 libobjc.A。dylib
0x02bd840e objc_exception_throw + 47 2的CoreFoundation
0x02a8a6ab - [NSObject的(NSObject的) 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
0x003715ca - [UIViewController的視圖] + 179 7吸血鬼測驗最終
0x000021b1 - [Vampire_Quiz_FinalAppDelegate應用中:didFinishLaunchingWithOptions:] + 74 8的UIKit 0x002c7f27 - [UIApplication的 _callInitializationDelegatesForURL:有效載荷:懸浮:] + 1163 9的UIKit 0x002ca3b0 - [UIApplication的 _runWithURL:有效載荷: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_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 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吸血鬼測驗最終
0x00002144主+ 102 22吸血鬼 測驗最終0x000020d5 啓動+ 53)終止稱爲 拋出實例後的 'NSException' sharedlibrary施加的負載規則所有 (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 

我怎樣才能解決這個問題???

回答

0

發送到實例的無法識別的選擇器:這意味着找不到該類的方法。檢查課程實施。

1

你正在使用self.bannerIsVisible,但我看不到既不合成這個也不是setter和getters。你有沒有在你的.h文件中使用bannerIsVisible

要解決此崩潰問題,您應該在您的頭文件中定義屬性並在您的實現中添加@synthesize語句。


也許你應該有一些更基本的開始結識樣特性,合成器,編譯器警告的根本的東西(應該有一個),調試等。
我不想粗魯,但是使用不明白的複製代碼不會學到太多東西。

+0

感謝您的幫助! – Simon 2010-11-06 09:56:23

+0

是的我在.h文件中創建了一個屬性 – Simon 2010-11-06 09:58:17

+0

#import #import ; @interface Vampire_Quiz_FinalViewController:的UIViewController { \t ADBannerView * AD瀏覽; \t BOOL bannerIsVisible; } @property(nonatomic,assign)BOOL bannerIsVisible; (IBAction)V; - (IBAction)V; (IBAction)A; - (IBAction)A; - (IBAction)I; @end – Simon 2010-11-06 09:58:32

相關問題