这篇文章主要介绍了searchDisplayController 引起的数组越界处理办法,需要的朋友可以参考下
下面把searchDisplayController 引起的数组越界处理办法给大家分享如下:
当[searchDisplayController.searchResultsTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone] 时,发送了崩溃
错误提示如下:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c6c6c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c35fbb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010c5bd17e -[__NSArrayI objectAtIndex:] + 190
3 UIKit 0x000000010d230fd2 -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 106
4 UIKit 0x000000010cdfb1b9 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 1711
查了好久才查到原因: 在错误log中有提示
3 UIKit 0x000000010d230fd2 -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 106
解决方法:
-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 0;
}
以上代码就是针对searchDisplayController 引起的数组越界处理办法的解决方案,希望对大家有所帮助。
沃梦达教程
本文标题为:searchDisplayController 引起的数组越界处理办法


基础教程推荐
猜你喜欢
- Android Compose自定义TextField实现自定义的输入框 2023-05-13
- Android开发Compose集成高德地图实例 2023-06-15
- Android实现短信验证码输入框 2023-04-29
- iOS中如何判断当前网络环境是2G/3G/4G/5G/WiFi 2023-06-18
- MVVMLight项目Model View结构及全局视图模型注入器 2023-05-07
- Flutter进阶之实现动画效果(三) 2022-10-28
- iOS开发使用XML解析网络数据 2022-11-12
- iOS开发 全机型适配解决方法 2023-01-14
- iOS Crash常规跟踪方法及Bugly集成运用详细介绍 2023-01-18
- IOS获取系统相册中照片的示例代码 2023-01-03