iPhone崩溃时呈现模态视图控制器 [英] iPhone crashing when presenting modal view controller

查看:375
本文介绍了iPhone崩溃时呈现模态视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我试图在模式显示另一个视图后直接显示模式视图(第二个是显示的加载视图) code> - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
//显示加载
LoadViewController * loader = [[LoadViewController alloc] init];
[self presentModalViewController:loader animated:NO];
[loader release];
}

但是当我这样做时,我得到一个程序接收信号:EXC_BAD_ACCESS 。错误。



堆栈跟踪是:

  0 0x30b43234 in  - [UIWindowController transitionViewDidComplete:fromView:toView:] 
1 0x3095828e in - [UITransitionView notifyDidCompleteTransition:]
2 0x3091af0d in - [UIViewAnimationState sendDelegateAnimationDidStop:finished:]
3 0x3091ad7c in - [UIViewAnimationState animationDidStop:finished :]
4 run_animation_callbacks中的0x0051e331
5 CA :: timer_callback中的0x0051e109
6 CFRunLoopRunSpecific中的
6 0x302454a0 7 CFRunLoopRunInMode中的0x30244628
8 GSEventRunModal中的0x32044c31
9 0x32044cf6 in GSEventRun
10 0x309021ee in UIApplicationMain
11 0x00002154 in main.m:14

任何想法?我完全被骗了!加载视图是空的,所以肯定没有发生在那里导致的错误。



感谢,



Mike



编辑:很奇怪...我稍微修改它,使加载视图显示一个微小的延迟后,这工作很好!所以它似乎是在同一个事件循环内的东西。

   - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
//显示加载
[self performSelector:@selector(doit)withObject:nil afterDelay:0.1];
}

- (void)doit {
[self presentModalViewController:loader animated:YES];
}


解决方案

加载视图显示一个微小的延迟后,这工作正常!所以它似乎是在同一个事件循环内的东西。

   - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
//显示加载
[self performSelector:@selector(doit)withObject:nil afterDelay:0.1];
}

- (void)doit {
[self presentModalViewController:loader animated:YES];
}


I'm trying to display a modal view straight after another view has been presented modally (the second is a loading view that appears).

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    // Show load
    LoadViewController *loader = [[LoadViewController alloc] init];
    [self presentModalViewController: loader animated:NO];
    [loader release];
}

But when I do this I get a "Program received signal: "EXC_BAD_ACCESS"." error.

The stack trace is:

0  0x30b43234 in -[UIWindowController transitionViewDidComplete:fromView:toView:]
1  0x3095828e in -[UITransitionView notifyDidCompleteTransition:]
2  0x3091af0d in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
3  0x3091ad7c in -[UIViewAnimationState animationDidStop:finished:]
4  0x0051e331 in run_animation_callbacks
5  0x0051e109 in CA::timer_callback
6  0x302454a0 in CFRunLoopRunSpecific
7  0x30244628 in CFRunLoopRunInMode
8  0x32044c31 in GSEventRunModal
9  0x32044cf6 in GSEventRun
10 0x309021ee in UIApplicationMain
11 0x00002154 in main at main.m:14

Any ideas? I'm totally stumped! The loading view is empty so there's definitely nothing going on in there that's causing the error. Is it something to do with launching 2 views modally in the same event loop or something?

Thanks,

Mike

Edit: Very strange... I have modified it slightly so that the loading view is shown after a tiny delay, and this works fine! So it appears to be something within the same event loop!

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    // Show load
    [self performSelector:@selector(doit) withObject:nil afterDelay:0.1];
}

- (void)doit {
    [self presentModalViewController:loader animated:YES];  
}

解决方案

I have modified it slightly so that the loading view is shown after a tiny delay, and this works fine! So it appears to be something within the same event loop!

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    // Show load
    [self performSelector:@selector(doit) withObject:nil afterDelay:0.1];
}

- (void)doit {
    [self presentModalViewController:loader animated:YES];  
}

这篇关于iPhone崩溃时呈现模态视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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