0
我有一个collectionview,但当我试图点击图像它显示此错误?整个应用程序是一个tabbar应用程序,所有其他选项卡都在工作。除了最后一个标签图片。从plist中 IAM拍摄图像用于显示入的CollectionView 这是错误当我点击一个项目在我的收藏查看我得到这个错误
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI
objectAtIndex:]: index 0 beyond bounds for empty array'*** First throw call stack: (0x1e92012
0x1969e7e 0x1e47b44 0x58b91 0x56686 0x137cf 0x98f1c7 0x98f232 0x98f4da 0x9a68e5 0x9a69cb 0x9a6c76
`0x9a6d71 0x9a789b 0x9a7e93 0x9a7a88 0xd03e63 0xcf5b99 0xcf5c14 0xdaf5d9 0xdc1182 0xdc1394 0x197d705
0x9bb93c 0x9bb9ac 0x197d705 0x9bb93c 0x9bb9ac 0xb751d3 0x1e5aafe 0x1e5aa3d 0x1e387c2 0x1e37f44
0x1e37e1b 0x3c0f7e3 0x3c0f668 0x8adffc 0x287d 0x27a5) libc++abi.dylib: terminate called throwing an exception
这是用于使该阵列到另一个的ViewController
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"bookItem"]) {
NSDictionary *currentBook = [[_freeBooks objectForKey:@"freebook"] objectAtIndex:[[[self.collectionView indexPathsForSelectedItems] objectAtIndex:0] row]];
NSLog(@"%@", currentBook);
GMMDetailpage *detailpage = (GMMDetailpage *)[segue destinationViewController];
detailpage.bookDetails = currentBook;
NSLog(@"%@",detailpage.bookDetails);
}
}
的didselect方法和preparesegue
当前书的值是印刷和罚款......但在此之后,它执行一些其他系统代码,然后它显示异常。检查图像
难道你不明白这个错误吗? – 2013-04-08 06:38:10
nop,我检查了数组的,但它不是空的 – Naveen 2013-04-08 06:38:48
请张贴一些代码,有一个数组越界的异常意味着你试图访问一个没有元素的数组。 – satheeshwaran 2013-04-08 06:39:20