2017-12-04 3 views
0

私はXibファイルをカスタムとして使用していますテーブルビューセル。しかし、私がアプリケーションを実行するたびにクラッシュします。 、/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7 [::forIndexPathのUITableView dequeueReusableCellWithIdentifier] - 私は私がで*カスタムTableViewセルとしてXibファイルがクラッシュする

下にアサーションの失敗を投稿このクラッシュログを取得します。 47/UITableView.m:6730 2017-12-04 17:23:16.070 iCommander [2489:135476] *キャッチされていない例外 'NSInternalInconsistencyException'によりアプリを終了しています、理由: '識別子Cellのセルをデキューできません - 登録する必要がありますスタイラスボードのプロトタイプセルを接続する ***ファーストスローコールスタック: ( 0 CoreFoundation 0x00000001035f6b0b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010305b141 objc_exception_throw + 48 2 CoreFoundationの0x00000001035facf2 + [NSExceptionレイズ:フォーマット:引数:] + 98 3ファンデーション0x0000000102bf5536 - [NSAssertionHandler handleFailureInMethod:目的:ファイル:行番号:説明:] + 193 4のUIKit 0x00000001042eae45 - [のUITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 241 5 iCommander 0x0000000101e6b43f _TFC10iCommander25CommentsHistoryController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 303 6 iCommander 0x0000000101e6ba07 _TToFC10iCommander25CommentsHistoryController9tableViewfTCSo11UITableView12cellForRowAtV10Foundation9IndexPath_CSo15UITableViewCell + 87 7のUIKit 0x00000001042fdab2 - [UIT ableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 750 8のUIKit 0x00000001042fdcf8 - [のUITableView _createPreparedCellForGlobalRow:willDisplay:] + 74 9のUIKit 0x00000001042d2639 - [のUITableView _updateVisibleCellsNow:isRecursive:] + 2845 10のUIKit 0x0000000104306ccc - [のUITableView _performWithCachedTraitCollection:] + 111 11のUIKit 0x00000001042ede7a - [のUITableView layoutSubviews] + 233 12のUIKit 0x000000010425455b - [UIViewの(CALayerDelegate)layoutSublayersOfLayer:] + 1268 13 QuartzCore 0x0000000102429904 - [CALayerのlayoutSublayers] + 146 14 QuartzCore 0x000000010241d526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370 15 QuartzCore 0x000000010241d3a0 _ZN2CA5La yer28layout_and_display_if_neededEPNS_11TransactionE + 24 16 QuartzCore 0x00000001023ace92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 17 QuartzCore 0x00000001023d9130 _ZN2CA11Transaction6commitEv + 468 18 QuartzCore 0x00000001023d9b37 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 115 19 CoreFoundationの0x000000010359c717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 20 CoreFoundationの0x000000010359c687 __CFRunLoopDoObservers + 391 21 CoreFoundationの0x0000000103581720 __CFRunLoopRun + 1200 22 CoreFoundationの0x0000000103581016 CFRunLoopRunSpecific + 406 23 GraphicsServices 0x00000001091e1a24 GSEventRunModa l + 62 24 UIKit 0x0000000104191134 UIApplicationMain + 159 25 iCommander 0x0000000101e13ea7 main + 55 26 libdyld.dylib 0x000000010743e65d start + 1 27 ??? 0x0000000000000001 0x0 + 1 ) libC++ abi。dylib:NSException型のキャッチされない例外で終了する

助けてください。前もって感謝します。あなたはXIBファイルを登録するのを忘れsetting cell identifier for reusing cell with that identifier

+1

あなたはクラッシュログを読みましたか? '未知の例外が原因でアプリケーションを終了しています' NSInternalInconsistencyException '、理由:'識別子Cellを持つセルをデキューできません - 識別子のnibまたはクラスを登録するか、ストーリーボードのプロトタイプセルを接続する必要があります '' – dasdom

+0

助けてくれてありがとう。問題が解決しました。 – NoobDev

答えて

3

:としてXIBファイル内のカスタムセルへ

+1

ありがとうございました。それを解決した。あなたをアップウォークできませんでした。私は現在アップ投票の対象にはなっていません。 – NoobDev

+0

問題のある人はいません。 :) –

0

セットセル識別子。クラッシュを取り除くためにxibファイルを登録する必要があります。

I のnスウィフト3

let xib = UINib(nibName: "YourCustomCell", bundle: nil) 
tableView.register(xib, forCellReuseIdentifier: "Cell") 

あなたはそのようにカスタムセルを登録する必要があります。

希望します。

+0

私はすでに識別子を使用しています。私はセルを登録していない1つのことを逃しました。あなたの助けに感謝します。問題が解決しました。 – NoobDev

0

スウィフトIN 3

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell 
    { 
     let cell = Bundle.main.loadNibNamed("XibName", owner: self, options: nil)?.first as! XibName 

return cell 

    } 
関連する問題