- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我开发了一个应用程序,在测试中运行良好,但当它可以运行时,我在呈现模态视图 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/
救命!我已经为这个问题苦恼了 1 个小时了。 我正在我的 .h 文件中创建一个数组 @interface LeftMenuViewController : UIViewController
我想使用 NSMutableArray 中的 ValueForKey 替换 objectAtIndex。我已经尝试了下面的代码,但是没有用,它崩溃了, [[students valueForKey:@
我有一个包含 10 个对象的 Array。我将第一个对象放入带有 String 的 Label 中。 然后我想要一个将 objectAtIndex 增加 1 的方法。 这是我的代码: //.m @in
我有 NSMutableArray “Tag”,其对象位于索引 0 上:“data”、“data1”、“data2”,索引 1:“data3”,索引 2:“data2” ...我选择的标签是“data
嗨,我有一个数组数组,我在添加某个索引后删除了一个对象。不知何故,我认为这表现得很奇怪,或者我可能忽略了一些事情。这是代码。我用 nslogs 对其进行跟踪。 for (int i = 0;
在我的 UIScrollView 中,我的数组中有 30 张图像。我尝试在数组中获取 objectAtIndex。我希望能够在 UIScrollView 停止滚动时在特定图像中显示动画。所以我在下面尝
如何在我的方法中获取 objectAtIndex。 例如,如果我使用 didSelectRowAtIndexPath:(NSIndexPath *)indexPath 我可以得到它 NSLog(@"
我正在尝试掌握 Objective C 和 Cocoa,所以我可能在这里使用了错误的术语。 我为一副纸牌创建了一个 Objective C 类,由我的主 AppDelegate.h 和 AppDele
我在使用 NSFetchedResultsController objectAtIndex 时出现内存泄漏:栈帧如下: 0 CoreFoundation __CFDataAllocate
我正在开发iOS应用程序。值存储在Array上,但是当我运行应用程序时,它崩溃,数组索引超出范围。请先帮助并谢谢。 代码: daysOfWeek = [NSArray arrayWithObjects
我有一个我想要一个值的 NSArray。 _membersArray = [_detailItem valueForKey:@"members"]; 当我使用此代码时: NSLog(@"%lu", (
我有一个 UITableView,它由从 XML 提要解析的数据数组填充。我正在努力寻找此错误的原因,并想知道是否有人可以帮助我。该错误不会经常发生。它仅在数组数量很大时发生,例如 10-15 个对象
我收到上述错误,但不知道为什么,因为我在另一个示例中实现了相同的代码。 “服务”是我的 NSMutableArray,“服务名称”是带有标签 2 的 TableView 上的标签。在 viewdidl
初学者 iOS 开发问题在这里。 我有以下格式的 plist: 我在我的应用程序中使用以下方法将这个 plist 转换为一个数组: NSMutableArray *array2 = [[NSMutab
我正在构建一个简单的 Swift CoreData TableView 应用程序。我已成功将数据保存到数据库并在 TableView 中重新加载数据。接下来我要做的是编辑这些数据。通过点击表格单元格/
所以我在这里有函数 collectionView: cellForItemAtIndexPath: func collectionView(collectionView: UICollectionVi
NSInteger *count = [monLessonArrayA count]; 对于 (i = 0; i < count; i++) { arrayVar = [monLessonArrayA
2012-06-15 17:53:25.532 BadgerNew[3090:707] *** Terminating app due to uncaught exception 'NSRangeEx
这个问题在这里已经有了答案: 关闭 9 年前。 Possible Duplicate: Is there some literal dictionary or array syntax in Obj
我有一个 NSArray,其中包含索引 0 - 9 的 10 个对象。数组中的每个条目都是一个引号。 当我的用户选择“随机引用”选项时,我希望能够从数组中选择一个随机条目并显示该条目中包含的文本。 有
我是一名优秀的程序员,十分优秀!