【问题标题】:UISearchController example crashes if animated = NO如果动画 = NO,UISearchController 示例会崩溃
【发布时间】:2014-11-06 00:20:29
【问题描述】:

我想使用新的 UISearchController,我下载了苹果提供的 Obj-C 示例:

https://developer.apple.com/library/ios/samplecode/TableSearch_UISearchController/Introduction/Intro.html

在 APLMainTableViewController.m 的第 123 行,当我们点击 tableview 中的一行时,我们会执行该方法

123   - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
124        APLProduct *selectedProduct = (tableView == self.tableView) ?
125            self.products[indexPath.row] : self.resultsTableController.filteredProducts[indexPath.row];
126
127        APLDetailViewController *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"APLDetailViewController"];
128        detailViewController.product = selectedProduct; // hand off the current product to the detail view controller
129
130        [self.navigationController pushViewController:detailViewController animated:YES];
131
132        // note: should not be necessary but current iOS 8.0 bug (seed 4) requires it
133        [tableView deselectRowAtIndexPath:indexPath animated:NO];
134    }

如果在第 130 行,我将“animated:YES”更改为“animated:NO”,应用程序将在以下情况下崩溃(我在 iOS 模拟器中针对 iPhone 5s / iOS 8 进行了测试)

  • 在搜索框中输入一些内容,例如“iPod”
  • 点击搜索结果的第一行。它将推送 iPod 详细视图
  • 现在点击导航按钮“
  • 表格视图显示时没有搜索框,应用程序因 EXC_BAD_ACCESS 而崩溃

有人能重现这个问题并知道为什么会这样吗?

已编辑:Apple 的错误报告 #18859420

【问题讨论】:

    标签: objective-c ios8 uikit uisearchcontroller


    【解决方案1】:

    子问题:第 132 和 133 行指出了 iOS 8.0 中的一个错误。我怎么知道这个 bug 已经解决了?

    假设您已针对该问题向http://bugreport.apple.com 提交了雷达,您可以通过雷达请求 ADC 的状态更新。

    此外,请在编辑您的问题时报告雷达编号。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-27
      • 1970-01-01
      相关资源
      最近更新 更多