質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Q&A

解決済

1回答

802閲覧

[超初心者????]Thread1:signal SIGABRTと出ます。

yudai0224

総合スコア17

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

1グッド

0クリップ

投稿2019/08/15 05:37

編集2019/08/15 05:45

イメージ説明

超初心者です。申し訳ございません。
シュミレーターを使うとこう出てしまいます。優しい方、解決策を教えていただけませんでしょうか。

kbel23👍を押しています

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

TakuyaAso

2019/08/15 05:43

デバッグエリアのログで reason という文字列を検索して記載してください。
yudai0224

2019/08/15 05:50

0 CoreFoundation 0x000000010ef136fb __exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010cf70ac5 objc_exception_throw + 48 2 CoreFoundation 0x000000010ef31ab4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 UIKitCore 0x000000011c375c3d -[UIResponder doesNotRecognizeSelector:] + 287 4 CoreFoundation 0x000000010ef18443 ___forwarding___ + 1443 5 CoreFoundation 0x000000010ef1a238 _CF_forwarding_prep_0 + 120 6 UIKitCore 0x000000011c58f1fe -[UITableView _numberOfRowsInSection:] + 62 7 UIKitCore 0x000000011c5a100f -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2599 8 UIKitCore 0x000000011c5a71c5 -[UITableViewRowData rectForFooterInSection:heightCanBeGuessed:] + 475 9 UIKitCore 0x000000011c5a732b -[UITableViewRowData heightForTable] + 61 10 UIKitCore 0x000000011c540cc1 -[UITableView _updateContentSizeSkippingContentOffsetAdjustment:] + 362 11 UIKitCore 0x000000011c56eee1 -[UITableView _rebuildGeometryForcingRowDataUpdate:skipContentOffsetAdjustment:updateImmediatelyIfPossible:] + 112 12 UIKitCore 0x000000011c56c96b -[UITableView didMoveToWindow] + 145 13 UIKitCore 0x000000011c80eaf5 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1817 14 UIKitCore 0x000000011c791e3d -[UIScrollView _didMoveFromWindow:toWindow:] + 88 15 UIKitCore 0x000000011c80e69f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 707 16 UIKitCore 0x000000011c8014ee __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151 17 Foundation 0x000000010bfb5fa2 -[NSISEngine withBehaviors:performModifications:] + 110 18 UIKitCore 0x000000011c8013e8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 822 19 UIKitCore 0x000000011c81163d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1948 20 UIKitCore 0x000000011c7d4749 -[UITransitionView transition:fromView:toView:removeFromView:] + 1540 21 UIKitCore 0x000000011bd703f2 -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 2080 22 UIKitCore 0x000000011bc67985 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 3088 23 UIKitCore 0x000000011c354cc9 _runAfterCACommitDeferredBlocks + 318 24 UIKitCore 0x000000011c344199 _cleanUpAfterCAFlushAndRunDeferredBlocks + 358 25 UIKitCore 0x000000011c37132b _afterCACommitHandler + 124 26 CoreFoundation 0x000000010ee7a0f7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 27 CoreFoundation 0x000000010ee745be __CFRunLoopDoObservers + 430 28 CoreFoundation 0x000000010ee74c31 __CFRunLoopRun + 1505 29 CoreFoundation 0x000000010ee74302 CFRunLoopRunSpecific + 626 30 GraphicsServices 0x0000000110a3a2fe GSEventRunModal + 65 31 UIKitCore 0x000000011c349ba2 UIApplicationMain + 140 32 recpiation creation 0x000000010ba8918b main + 75 33 libdyld.dylib 0x0000000115c8f541 start + 1 34 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
yudai0224

2019/08/15 05:51

すみません」、見つかりませんでしたので全文送りました。何か気づかれましたら返信の方よろしくお願いします。
guest

回答1

0

ベストアンサー

Storyboard側の問題じゃないですかね?
以下を確認してみてください。

  • ViewControllerのクラスがTableViewControllerになっていること
  • UITableViewがMyTVと結びついていること
  • UITableViewのdelegate, dataSourceがowner(TableViewController)となっていること

 +それ以外と関連づいていないこと(名前を変えたりコピった時によくあるので)

あと、これとは関係ないですが、cellForRowAtでdequeueReuseableCellで取得した変数を捨てて、そのあとにメンバ変数のcellに値を設定していますが、もしかしてcellをreturnしていませんか?これはうまくいきません。
dequeueReusableCellで取得したセルを返すようにしてください。
staticなUITableViewでない限り、ほとんどのケースでUITableViewがメンバ変数になることはないはずです。(その設計は大抵潜在的な問題があります)

追記

Swift

1func tableView(_ tableView: UITableView, cellForRowAt indexPath:IndexPath) -> UITableViewCell 2{ 3 let cell = tableView.dequeueReusableCell(withIdentifier:"cell", for:indexPath) 4 cell.textLabel!.text = TODO[indexPath.row] 5 return cell 6}

投稿2019/08/15 06:32

編集2019/08/15 13:50
toki_td

総合スコア2850

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yudai0224

2019/08/15 06:54

ご指摘ありがとうございます。 後者の質問なんですが、 cell.textLabel!.text = TODO[indexPath.row] return cell のところですよね?そこにThread 1が出ていました。 どのようなコードにすればよいのでしょうか。返信いただけると幸いです。
toki_td

2019/08/15 13:51

追記したようにdequeueReusableCellの戻り値のUITableViewを(テキストなど設定して)returnしてくださいという意味です。 このあたりのやり方はUITableViewの基本なのでちゃんと押さえておかないと意味不明なエラーに泣かされます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問