views:

34

answers:

1

-[NSCFString bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0xbc459c0 2010-08-30 12:01:37.340 Transit[2892:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0xbc459c0' * Call stack at first throw: (

0 CoreFoundation 0x02a47b99 __exceptionPreprocess + 185

1 libobjc.A.dylib 0x02b9740e objc_exception_throw + 47

2 CoreFoundation 0x02a496ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x029b92b6 forwarding + 966

4 CoreFoundation 0x029b8e72 _CF_forwarding_prep_0 + 50

5 iAd 0x000d24e5 -[ADBannerView _sanitizeAndForwardErrorToDelegate:] + 82 6 iAd 0x000e225c -[ADSession serverCenterDidTerminate] +235

7 iAd 0x000e4b64 -[ADSessionManager serverCenterDidTerminate:] + 243

8 Foundation 0x001360e1 _nsnote_callback + 145 9 CoreFoundation 0x02a1ff29 __CFXNotificationPost_old + 745 10 CoreFoundation 0x0299f26a CFXNotificationPostNotification + 186 11 Foundation 0x0012bc8a -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 12 Foundation 0x00137fc9 -[NSNotificationCenter postNotificationName:object:] + 56 13 AppSupport 0x02e86713 _-[CPDistributedMessagingCenter _setupInvalidationSource]_block_invoke_3 + 127 14 libSystem.B.dylib 0x907a6fe4 _dispatch_call_block_and_release + 16 15 libSystem.B.dylib 0x90799a4c _dispatch_queue_drain + 249 16 libSystem.B.dylib 0x9079ac64 _dispatch_queue_serial_drain_till_empty + 14 17 libSystem.B.dylib 0x907a8361 _dispatch_main_queue_callback_4CF + 49 18 CoreFoundation 0x02987099 __CFRunLoopRun + 2521 19 CoreFoundation 0x02986350 CFRunLoopRunSpecific + 208 20 CoreFoundation 0x02986271 CFRunLoopRunInMode + 97 21 GraphicsServices 0x04acbfec GSEventRunModal + 217 22 GraphicsServices 0x04acc0b1 GSEventRun + 115 23 UIKit 0x003db272 UIApplicationMain + 1160 24 Transit 0x000025dc main + 102 25 Transit 0x0000256d start + 53 26 ??? 0x00000001 0x0 + 1 )

terminate called after throwing an instance of 'NSException'

adView = [[ADBannerView alloc] initWithFrame:CGRectOffset(adView.frame, 0, 0)];
    //adView.frame = CGRectOffset(adView.frame, 0, 0);
    adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
    [self.view addSubview:adView];
    adView.delegate=self;
    self.bannerIsVisible=NO;

    adView.requiredContentSizeIdentifiers = [NSSet setWithObjects:ADBannerContentSizeIdentifier320x50,ADBannerContentSizeIdentifier480x32,nil];



#pragma mark ADBannerViewDelegate methods
  • (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, 44);
    
    
    [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;
    

    } }

  • (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {

    NSLog(@"Banner view is beginning an ad action");

    BOOL shouldExecuteAction = YES;

    if (!willLeave && shouldExecuteAction)

    {

    // stop all interactive processes in the app
    
    
    // [video pause];
    
    
    // [audio pause];
    

    } return shouldExecuteAction;

}

  • (void)bannerViewActionDidFinish:(ADBannerView *)banner { // resume everything you've stopped

    // [video resume];

    // [audio resume];

}

+1  A: 

Just Grab the sample code from here & go through it. I think it would help you.

sugar