このチュートリアルを使用して段階的に進み、UISearchController を実装したいと思います。
MKLocalSearchRequest を使用して場所を検索し、UISearchController で結果を表示します
そして、このセクションでは...
MKLocalSearchRequest を使用して場所を検索する
...ステップ 3 に問題があります。テーブル ビュー データ ソースの設定
extension LocationSearchTable {
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return matchingItems.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell")!
let selectedItem = matchingItems[indexPath.row].placemark
cell.textLabel?.text = selectedItem.name
cell.detailTextLabel?.text = ""
return cell
}
}
override
tableView 関数から削除しようとしcellForRowAtindexPath
ています。この場合、Xcode にエラーはありませんが、実行後にエラーが発生します。
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'UITableView (<UITableView: 0x7ff8e03a3800; frame = (0 0; 375 667); clipsToBounds = YES; autoresize = W+H;
gestureRecognizers = <NSArray: 0x604002046450>; layer = <CALayer: 0x604001626620>;
contentOffset: {0, -56}; contentSize: {375, 132};adjustedContentInset: {56, 0, 0, 0}>)
failed to obtain a cell from its dataSource(<CityWeather.LocationSearchTable: 0x7ff8de696e60>)'
エラーメッセージが叫ぶ:failed to obtain a cell from its dataSource(<CityWeather.LocationSearchTable: 0x7ff8de696e60>)
私が間違っていることを教えてください。そして、どうすればこの問題を処理できますか?? ありがとう。