Uialertview解雇返回主屏幕
我的应用程序以一个“主屏幕”导航控制器开始,该导航控制器位于自己的故事板上,并且可以转到不同的故事板,每个故事板都以新的导航控制器开始。我的次要故事板之一有付费墙。当用户选择在不进行购买的情况下解雇付费墙时,我所能完成的一切就是解雇付费墙,并显示需要购买的故事板的根视图控制器。我正在尝试将用户送回“主屏幕”,在那里他们可以看到其他内容或segue到其他故事板。
[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:^{}];
}];
当用户通过按确定按钮来删除UialertView时,我需要回到主导航控制器(主屏幕)。当前,当用户删除UialerTview时,他们可以访问付费内容。如果我删除了封闭的处理程序,则该应用程序会卡在付费墙上,直到购买或用户杀死该应用程序为止。任何帮助将不胜感激。我仍在与Objective-C斗争,没有时间学习Swift,所以请放轻松。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了。解决方案在这里:
I figured it out. The solution is here: