我一直在尝试将iAds实现到我的应用程序中,但这是发生的事情:
1.点击应用2.Loading屏幕显示几秒钟3.App崩溃
这是什么返回:
2010-11-06 20:19:11.043 Vampire Quiz Final [99722:207] Interface Builder文件中的未知类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 __forwarding 966 4的CoreFoundation 0x029f9e72 _CF_forwarding_prep_0 50 5吸血鬼测验最终0x000027a2 - [Vampire_Quiz_FinalViewController viewDidLoad中] 601 6的UIKit 0x003715ca - [UIViewController的视图] 179 7吸血鬼测验最终0x000021b1 - [Vampire_Quiz_FinalAppDelegate application:didFinishLaunchingWithOptions:] 74 8 UIKit 0x002c7f27 - [UI Application _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_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 apply-load-rules a ll(gdb)
附:我是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
我该怎么办呢???
2 回答
发送到实例的无法识别的选择器:这意味着找不到该类的方法 . 检查类实现 .
你正在使用
self.bannerIsVisible
,但我既看不到合成这个,也没有看到setter和getters . 你在.h文件中用bannerIsVisible
创建了一个属性吗?要解决此崩溃,您应该在标头中定义属性并在实现中添加@synthesize语句 .
也许你应该从更基础的东西开始,以了解基本的东西,如属性,合成器,编译器警告(应该有一个),调试等等 .
我不会通过使用您不理解的复制代码来学习很多东西 .