My app starts with a "home screen" navigation controller that sits in its own storyboard, and can segue to different storyboards, each beginning with a new navigation controller. One of my secondary storyboards has a paywall. When the user elects to dismiss the paywall without making a purchase, all I've been able to accomplish is dismissing the paywall and displaying the root view controller of the storyboard that requires a purchase. I'm trying to send the user back to the "home screen" where they can see other content or segue to a different storyboard.
[PaywallManager registerBlockingPaywallClosedHandler:^{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Blocked Paywall Closed" message:@"Return to home screen without purchase." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[alertController dismissViewControllerAnimated:true completion:^{
}]
}];
[alertController addAction:okAction];
UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
[rootViewController presentViewController:alertController animated:true completion:^{}];
}];
When the user dismisses the UIAlertView by pressing the OK button, I need to segue back to the main navigation controller (home screen). Currently when the user dismisses the UIAlertView, they get access to the paid content. If I remove the closed handler, the app gets stuck on the paywall until a purchase is made or the user kills the app. Any help would be greatly appreciated. I am still struggling with Objective-C and haven't had time to learn Swift so please go easy on me.
I figured it out. The solution is here: