0

Hi I am using latest flurry SDK 6.0 in app. I need to show ads almost every where in my app. App is UINavigationControllerBased contains more viewControllers. I am using code given in flurry documentation.

I am using below code in each and every ViewController but some times I move fast just like push and pop before add received,so in that case callbacks are continuously receiving but that viewcontroller is not available in stack at that time app crash or recieve memory. I tried to set adDelegate to nil in viewWillDisappear but flurry documentation says don't set it as nil. Anyone has any ideas regarading this?

-(void)viewDidAppear:(BOOL)animated
    {
      [super viewDidAppear:animated];

    if(self.adBanner == nil){
            self.adBanner = [[FlurryAdBanner alloc] initWithSpace:@"Flurry Banner"] ;
            self.adBanner.adDelegate = self;
            [self.adBanner fetchAndDisplayAdInView:self.view viewControllerForPresentation:self];
        }
}
Revolver_Ocelot
  • 8,609
  • 3
  • 30
  • 48
The iCoder
  • 1,414
  • 3
  • 19
  • 39

1 Answers1

0

Perhaps you should split the code in two?

Fetch the Ad using fetchAdForFrame. This prevents Flurry from using the view you passed.

Then inside the delegate, use displayAdInView. Only call this if you know the view is visible. So in viewWillAppear set a flag to say visible, in viewWillDisappear set a flag to say not visible. This should let you cut off the rendering part.

Seems odd an API like this would have no cancelFetchAd method!

Rory McKinnel
  • 7,936
  • 2
  • 17
  • 28