NSRangeException",原因:当显示视图控制器时,"***-[__ NSArrayM objectAtIndex:]:索引0超出空数组的边界" [英] NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' when presenting view controller

查看:47
本文介绍了NSRangeException",原因:当显示视图控制器时,"***-[__ NSArrayM objectAtIndex:]:索引0超出空数组的边界"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个在测试中运行良好的应用程序,但是当它可以使用时,在展示Modal View Controllers时我遇到了一些崩溃问题.问题出在这里的某些地方:

I have developed an app that in testing has worked fine but when it has could live I have had some issues with crashes when presenting Modal View Controllers. The issue is in here some where:

NSLog(@"Looks like we made it here 1");

UIViewController *mtaViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"mtaViewController"];
NSLog(@"Looks like we made it here 2");

[mtaViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
NSLog(@"Looks like we made it here 3");

[self presentModalViewController:mtaViewController animated:YES]; 
NSLog(@"Looks like we made it here 4");

我到控制台的输出是:

2012-06-14 09:26:24.161 appname[2013:707] Looks like we made it here 1
2012-06-14 09:26:24.165 appname[2013:707] Looks like we made it here 2
2012-06-14 09:26:24.166 appname[2013:707] Looks like we made it here 3
2012-06-14 09:26:28.866 appname[2013:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x343ac8bf 0x345fc1e5 0x342f5b6b 0x6d3fd 0x6e719 0x3778e7ff 0x37798d53 0x37798cc1 0x37838339 0x3783714f 0x37891d97 0x7ce1d 0x7cd47 0x3788eaa5 0x3776a81b 0x3776ffb9 0x34ec1ba7 0x36fe0e8d 0x3437f2dd 0x343024dd 0x343023a5 0x30b86fcd 0x37783743 0x84327 0x6b468)
terminate called throwing an exception

我已经设置了一个要更改视图控制器时要调用的函数,如您所见,它一直下降到看起来像我们在这里做了3",因此我怀疑这是一个问题线

I have set up in a function that I call when wanting to change view controllers and as you can see it makes it all the way down to "Looks like we made it here 3" so I suspect that there is an issue with line

[self presentModalViewController:mtaViewController animated:YES];

任何人都可以帮忙吗?

推荐答案

检查mtaViewController中的任何数组,我在您的代码中看不到任何数组,因此我认为问题出在mtaViewController中.:)

Check any array in mtaViewController, I dont see any array in your code so I'm thinking the issue is within mtaViewController. :)

这篇关于NSRangeException",原因:当显示视图控制器时,"***-[__ NSArrayM objectAtIndex:]:索引0超出空数组的边界"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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