0

I'm trying to add a custom action to the cancel button so that I can show banners again after done with the UIActivityViewController.

    [self presentViewController:activityController animated:YES completion:nil];
    [activityController setCompletionHandler:^(NSString *act, BOOL done)
     {
         if (!act) {
             NSLog(@"Cancel");
             [[RevMobAds session] showBanner];
         }
     }];

     }

This is what I've tried so far but it crashes when I press the UIActivityViewControllerbutton and shows the error:

exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller 
rmaddy
  • 314,917
  • 42
  • 532
  • 579
user2667306
  • 45
  • 1
  • 6

1 Answers1

0

The error is saying activityController is already on the stack.

edit: so to fix it, possibly consider [self popViewController: activityController animated:YES]; , then present it.

khanh.tran.vinh
  • 655
  • 5
  • 10