エラー事項
TableViewを使った時に、以下の部分で「Thread 1:signal SIGABRT」となって実行できない。
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {staticNSString*CellIdentifier =@"Cell";UITableViewCell*cell = [tableViewdequeueReusableCellWithIdentifier:CellIdentifierforIndexPath:indexPath]; cell.textLabel.text=cellList[indexPath.row]; cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;returncell; }
エラースクリーンショット
エラーのスクリーンショットはこんな感じ。
例外キャッチ
「Thread 1:signal SIGABRT」は厄介だなーと思いつつ、main.mに例外処理を埋め込み詳細を探ってみる。
@autoreleasepool { @try { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } @catch (NSException *exception) { NSLog(@"%@",exception); } }
次の例外をキャッチした。この内容によりググってみると。
2013-12-30 18:52:48.738 iDutch[1929:70b] *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:5261
どうやらセルに対する、Identifierの指定がなかったようだ。ガックシ。。。つまり以下のようにIdentifierを追加した。
まとめ
- 「Thread 1:signal SIGABRT」がでても焦らず、例外キャッチで見極める。
- プロパティの設定不足が多い気がする。
- グーグル先生は偉大である。