当前位置: 首页 > news >正文

Presenting view controllers on detached view controllers is discouraged

在做退出登录的时候遇到了 Presenting view controllers on detached view controllers is discouraged 的问题.

在做另外一个报名时,弹出imagePicker的时候也遇到了这个问题,有时候会导致卡死,so还是记录下看以后能不能找到解决办法。

发生问题的代码逻辑是:点击退出的row,然后弹出alert,点击alert后退出。

代码如下:

{UIAlertController *logoutAlertController = [UIAlertController alertControllerWithTitle:@"退出后不会删除任何历史数据,下次登录依然可以使用本账号。" message:nil preferredStyle:UIAlertControllerStyleActionSheet];[logoutAlertController addAction:[UIAlertAction actionWithTitle:@"退出登录" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {TYLog(@"点击了 退出登录");[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"mobile"];UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[LoginViewController alloc] init]];[UIApplication sharedApplication].keyWindow.rootViewController = nav;}]];[logoutAlertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {TYLog(@"点击了 取消");}]];[self presentViewController:logoutAlertController animated:YES completion:nil];}

不会发生问题的代码逻辑是点击row直接退出.

代码如下:

[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"mobile"];UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[LoginViewController alloc] init]];[UIApplication sharedApplication].keyWindow.rootViewController = nav;



http://www.taodudu.cc/news/show-2639138.html

相关文章:

  • 【physx/wasm】在physx中添加自定义接口并重新编译wasm
  • excel---常用操作
  • Lora训练Windows[笔记]
  • linux基础指令讲解(ls、pwd、cd、touch、mkdir)
  • InnoDB 事务处理机制
  • 启明云端ESP32 C3 模组WT32C3通过 MQTT 连接 AWS
  • The remote device or resource won't accept the connect
  • [java 手把手教程][第二季]java 后端博客系统文章系统——No7
  • 数据库学习纪要(十二):SQL Sever介绍-4
  • MapReduce之幺半群
  • 【后端】--process information unavailable解决办法[详细版]
  • ISCC2017 Misc write up附件题目文件
  • [割点问题]HOJ 12307 Disconnected Pair
  • 计算几何专项:UVa 12307
  • asp dotnet core 从零开始创建一个 WebApi 服务
  • UVa 12307 Smallest Enclosing Rectangle(旋转卡壳+最小覆盖矩形)
  • uva 12307(点集的外接矩形)
  • UVA 12307 Smallest Enclosing Rectangle(旋转卡壳)
  • uva 12307 - Smallest Enclosing Rectangle(旋转卡壳)
  • UVA 12307 Smallest Enclosing Rectangle
  • UVA 12307 旋转卡壳
  • uva12307(旋转卡壳)
  • UVA12307 Smallest Enclosing Rectangle 题解
  • numpy.ptp
  • gPTP与PTP理解资料参考
  • linux下ptp性能测试
  • 时统ptp_IEEE1588 PTP对时系统原理及特点
  • 时统ptp_IEEE1588对时系统,PTP校时模块,PTP时钟服务器
  • linuxptp源码研究
  • ptp输出内容包含什么_PTP技术及其应用分析
  • IEEE1588 Precision Time Protocol(PTP)
  • Linuxptp安装部署
  • Ubuntu 设置PTP时间同步
  • PTP时间同步
  • ptp4l linux,如何使用PTP4l测试PTPV2协议精度?
  • android ptp 源码分析,ptp增加豆瓣评分