- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我找不到任何合乎逻辑的解释,但事实仍然是,在iOS 5(xCode 4.2)中,如果我presentModalView:*animated:YES,我可以调用dismissModalViewAnimated:*很好,但如果我调用presentModalView:* animated:NO,则调用dismiss方法会崩溃。 (如果我使用新的presentViewController:animated:completion:+missViewControllerAnimated:效果相同)。我现在打算尝试解决这个问题(我不想让演示文稿动画化)并向苹果报告错误,但我已经为此苦恼了一段时间。欢迎任何和所有建议。 iOS 5 上的内容不多,所以请尽可能提供帮助。在 iOS 4 或 iOS 5 中不会崩溃的示例代码:
LoginController *loginController = [[LoginController alloc] initWithNibName:@"LoginControllerGG" bundle:nil];
[self presentModalViewController:loginController animated:YES];
[loginController release];
...
[self dismissModalViewControllerAnimated:YES];
这将在 iOS 5 中崩溃,并在拒绝调用时显示 EXC_BAD_ACCESS:
LoginController *loginController = [[LoginController alloc] initWithNibName:@"LoginControllerGG" bundle:nil];
[self presentModalViewController:loginController animated:NO];
[loginController release];
...
[self dismissModalViewControllerAnimated:YES]; //crashes with EXC_BAD _ACCESS
注意一点:我在 loginController 中有一个动画,它发生在 viewDidLoad 上。看看去掉它是否会改变什么,但我想把它拿出来,因为我需要尽快找到解决方案。
<小时/>[编辑]完整代码流程...在 AppDelegate 中,application:didFinishLaunchingWithOptions:
if (!loggedIn) [myViewController showLoginPanel];
在 myViewController 中:
- (void)showLoginPanel {
LoginController *loginController = [[LoginController alloc] initWithNibName:@"LoginControllerGG" bundle:nil];
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]) {
[self presentViewController:loginController animated:NO completion:nil];
} else {
[self presentModalViewController:loginController animated:NO]; //iOS 4 works fine with or without animation
}
[loginController release];
}
在登录 Controller 中:
- (IBAction)closeLoginWindow {
[[NSNotificationCenter defaultCenter] postNotificationName:@"CloseLoginWindow" object:nil];
} //doing it this way because calling on the self.parentViewController doesn't work
返回 myViewController:
- (void) viewDidLoad
...
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeLoginWindow) name:@"CloseLoginWindow" object:nil];
...
- (void)closeLoginWindow {
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
[self dismissViewControllerAnimated:YES completion:nil]; //iOS 5 crashes only if presentation was not animated
} else [self dismissModalViewControllerAnimated:YES]; //deleting the previous condition, iOS 5 still crashes if presentation was not animated
}
最佳答案
在 iOS5 中,生命周期的管理以某种方式发生了变化,我无法详细解释该问题。无论如何,修复方法是将工作流程从 applicationDidFinishLaunchingWithOptions 推迟到 applicationDidBecomeActive。似乎有些东西没有在调用 applicationDidFinishLaunchingWithOptions 时正确初始化。
- (void)applicationDidFinishLaunchingWithOptions:... {
// in order to do this only at launching, but not on every activation
// Declaration as property for example
applicationDidLaunch = YES;
}
- (void) applicationDidBecomeActive:(UIApplication *)application {
if (applicationDidLaunch) {
applicationDidLaunch = NO;
[Start your login Workflow with modal view presenting here]
}
}
很好奇你的反馈:)....
关于iphone - 解雇ModalViewControllerAnimated : (and dismissViewControllerAnimated) crashing in iOS 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7821617/
我的代码需要范围守卫,但是我是否必须手动 Dismiss() 从函数正常退出时所有范围守卫?即 void Deleter(MyClass* obj) { delete obj; } MyCla
当 UIPopoverController 被 UIPopoverController 本身的矩形之外的任何地方触摸解除时,是否有一个方法被调用? 状态: firstView 有一个 navBar。它
为调用实现 twilio,我尝试使用广播接收器而不是 twilio 逻辑的 Activity 。我的广播接收器应该通过 onReceive() 捕捉到 Intent ,但实际上并没有。听到了呼唤!但无
在我的应用程序中,我希望在多个 View 中显示 alertview。所以我所做的只是在实用程序类中编写了一个 alertview 并在任何地方使用它。这工作正常。 我什至尝试设置 但徒劳无功。 实用
我想使用具有以下行为/功能的 PopupWindow: 它是可聚焦的(在内部有交互式控件,例如按钮) 弹出窗口“下”的 View 必须正确使用弹出窗口外的触摸 .. 但弹出窗口必须保留在屏幕上,即使在
我正在为 tvOS 开发应用程序,但在取消 UIAlertController 时遇到问题。我在普通 UIViewController 之上呈现一个 UIAlertController。当我按下电视
我有一个 Controller A,还有一个 UIButton,单击它我将呈现一个新的 Controller B。但问题是 Controller B 首先嵌入了 NAV。所以最终我将介绍 UINavi
当我单击从 Web 服务打开所单击项目的数据的列表项时,我想打开一个 ProgressDialog。ProgressDialog 需要出现,直到被点击项目的 WebContent 被打开。 我知道使用
任何人都可以帮助我防止 alertview 在其按钮单击事件中被解雇吗?? 我有一个 textview 作为我的 alertView 的 subview ,如果 textview 的值为 nil,我不
这是按钮操作: @IBAction func readyPressed(sender: NSButton) { self.dismissController(Hardness)
我正在尝试防止当用户点击弹出窗口外部时弹出窗口被关闭。我似乎对此有其他问题/答案,他们似乎都建议使用 modalInPopover 作为 View 。正如我所看到的那样,我已经在 viewDidApp
我正在将 SFSafariViewController 推送到 UITabBarController 中。但单击 Safari 完成按钮会关闭 UITabBarController。如何预防? 最佳答
我有 2 个 viewcontroller,第一个 VC 包含 backButton。 firstVC.h @protocol DVDelegate -(void)DVViewControllerD
这是我的设置: 导航 Controller :ViewcontrollerA -> ViewControllerB ViewcontrollerB 显示一个 imagePickerController
我使用 ProgressDialog 向用户显示他必须等待,并在用户必须等待时使我的应用程序表面“不可触摸”。我向 progressDialog 添加了一个按钮,如果某些条件为真,它应该开始一些操作。
我目前正在尝试实现移动和导出模式的功能。我所做的就是让用户导航到他们想要将文件移动/导出到的目录,然后在他们选择的目录上调用 dismissGrantingAccessToURL,并附加原始文件的文件
我是一名优秀的程序员,十分优秀!