UIViewControllerdismissViewControllerAnimated:完成:导致应用程序冻结 [英] UIViewController dismissViewControllerAnimated: completion: causes app to freeze

查看:35
本文介绍了UIViewControllerdismissViewControllerAnimated:完成:导致应用程序冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 iPad 上的设置是一个 UISplitViewController,它处理应用程序的主要内容.这被设置为 UIWindow 的 rootViewController.

The setup I have on the iPad is a UISplitViewController that handles the main content of the app. This is set to the rootViewController of the UIWindow.

当应用启动时,我会测试用户是否能够登录网络服务.如果用户无法访问 Web 服务,则会向他们显示一个 UIViewController 子类,该子类处理用户的身份验证.UIViewController 子类通过调用模态呈现:<代码>[splitViewController presentViewController:loginViewController 动画:YES 完成:nil];

When the app launches, I test to see if the user is able to login to the web service. If the user isn't able to access the web service they are presented with a UIViewController subclass which handles the authentication for the user. The UIViewController subclass is presented modally by calling: [splitViewController presentViewController:loginViewController animated:YES completion:nil];

当用户成功登录后,loginViewController 会通过调用:<代码>[splitViewControllerdismissViewControllerAnimated:YES 完成:nil];

When the user successfully logs in, the loginViewController is dismissed by calling: [splitViewController dismissViewControllerAnimated:YES completion:nil];

使用揭示应用程序 (http://revealapp.com) 我能够看到 splitViewController 现在正在模态呈现,而不是按预期呈现.

Using reveal app (http://revealapp.com) I'm able to see that the splitViewController is now being presented modally rather than as expected.

由于 splitViewController 以模态呈现,它现在不接受来自用户的任何输入.

As a result of the splitViewController being presented modally, it now doesn't accept any input from the user.

有没有人遇到过这种情况并且能够帮助我.

Has anyone come across this scenario before and is able to help me out.

更新:

问题似乎与尝试登录时出现的 UIAlertView 有关.这出现在用户点击登录"和登录被验证之间.有谁知道为什么/这会导致问题?UIAlertView 没有被正确关闭,或者 LoginViewController 没有被关闭.

The problem looks like it is to do with a UIAlertView that gets presented when the login is being attempted. This appears between when the user taps on "Login" and the login is verified. Does anyone know why / how this would be causing a problem? Either the UIAlertView isn't being dismissed properly or the LoginViewController isn't.

谢谢,

马特

推荐答案

我想你想要的是:

[loginViewController dismissViewControllerAnimated:YES completion:nil];

代替

[splitViewController dismissViewControllerAnimated:YES completion:nil];

这篇关于UIViewControllerdismissViewControllerAnimated:完成:导致应用程序冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆