gpt4 book ai didi

iphone - NSRangeException',原因 : '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' when presenting view controller

转载 作者:搜寻专家 更新时间:2023-10-30 20:21:04 24 4
gpt4 key购买 nike

我开发了一个应用程序,在测试中运行良好,但当它可以运行时,我在呈现模态视图 Controller 时遇到了一些崩溃问题。问题出在这里:

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

我已经在我想要更改 View Controller 时调用的函数中进行了设置,正如您所看到的那样,它一直下降到“看起来我们在这里完成了 3”,所以我怀疑存在问题行

[self presentModalViewController:mtaViewController animated:YES];

有人能帮忙吗?

最佳答案

检查 mta ViewController 中的任何数组,我在您的代码中没有看到任何数组,所以我认为问题出在 mta ViewController 中。 :)

关于iphone - NSRangeException',原因 : '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' when presenting view controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11029469/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com