Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App crashing with +[NSDecimalNumber gad_negativeOne]: issue?

My app was working before well, then i added admob framework and now its crashing .

Please check the crash logs,

enter image description here

i have tried in Google but there is no result regarding this crash.

If i commented the contents inside viewDidAppear() then app is working(not loading app part). But if am trying to load "admob" then its crashing.


Code:

-(void)viewDidAppear:(BOOL)animated{
    if([Connectivity hasConnectivity]){
        // [self loadAds];
        NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 15.0 target: self
                                                          selector: @selector(callAfterSixtySecond:) userInfo: nil repeats: YES];
    }
}
-(void) callAfterSixtySecond:(NSTimer*) t
{
    
    if([GMMConnectivity hasConnectivity]){
        
        [self.adBanner removeFromSuperview];
        [self loadAdmob];
    }
}

-(void)loadAdmob{
    
    CGPoint origin;
    if(IS_RETINA){
        if([[UIScreen mainScreen] bounds].size.height >500){
            //        NSLog(@"5");
            origin = CGPointMake(0.0,
                                 568-
                                 CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
        }else{
            //        NSLog(@"4");
            
            origin = CGPointMake(0.0,
                                 (480)-
                                 CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
        }
    }else{
        //        NSLog(@"3");
        
        origin = CGPointMake(0.0,
                             (460)-
                             CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
        
    }
    // Use predefined GADAdSize constants to define the GADBannerView.
    self.adBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait
                                                   origin:origin]
    ;
    
    // Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID
    // before compiling.
    self.adBanner.adUnitID = MY_BANNER_UNIT_ID;
    self.adBanner.delegate = self;
    [self.adBanner setRootViewController:self];
    [self.view addSubview:self.adBanner];
    self.adBanner.center =
    CGPointMake(self.view.center.x, self.adBanner.center.y);
    [self.adBanner loadRequest:[self createRequest]];
    [self.view addSubview:adBanner_];
}
like image 452
Bangalore Avatar asked Nov 28 '22 03:11

Bangalore


1 Answers

You need to add "-ObjC" to Other Linker Flags of Build Settings tab. Good luck!

like image 93
Pei Avatar answered Dec 09 '22 13:12

Pei