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

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

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

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

Swift

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

Q&A

解決済

1回答

2476閲覧

Swift3 Xcode8 Thread 1: signal SIGABRT

Tats.N

総合スコア62

Xcode

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

Swift

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

0グッド

0クリップ

投稿2016/12/15 19:31

こんにちは。いつも有難うございます。
Table viewでArray内を表示させようとしているのですが、SIGABRT Errorが出ました。。iOS開発は始めたばかりでよくわからず。。これは何が起こっていますか?

それと、iOS開発のデバッグの際にどこを見ていけばいいのでしょうか?JavaScriptしか書けないのでイマイチデバッグの仕方がよくわかっていません。何かオススメの方法などありませんか?

宜しくお願いします。

0x109924d0f <+111>: xorl %edi, %edi

エラー内容

2016-12-15 11:21:19.296 TodoList[9366:267817] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.5.2/UITableView.m:8035 2016-12-15 11:21:19.305 TodoList[9366:267817] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7fe3bf02f800; frame = (0 170; 414 566); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x600000049630>; layer = <CALayer: 0x608000031d80>; contentOffset: {0, 0}; contentSize: {414, 132}>) failed to obtain a cell from its dataSource (<TodoList.ViewController: 0x7fe3bd70a100>)' *** First throw call stack: ( 0 CoreFoundation 0x000000010cce434b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010a11221e objc_exception_throw + 48 2 CoreFoundation 0x000000010cce8442 +[NSException raise:format:arguments:] + 98 3 Foundation 0x0000000109ca8e4d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 UIKit 0x000000010a73bbfe -[UITableView _configureCellForDisplay:forIndexPath:] + 222 5 UIKit 0x000000010a74781c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 860 6 UIKit 0x000000010a747a13 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74 7 UIKit 0x000000010a71b47d -[UITableView _updateVisibleCellsNow:isRecursive:] + 3295 8 UIKit 0x000000010a750d95 -[UITableView _performWithCachedTraitCollection:] + 110 9 UIKit 0x000000010a7375ef -[UITableView layoutSubviews] + 222 10 UIKit 0x000000010a69ef50 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237 11 QuartzCore 0x000000010fa33cc4 -[CALayer layoutSublayers] + 146 12 QuartzCore 0x000000010fa27788 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 13 QuartzCore 0x000000010fa27606 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 14 QuartzCore 0x000000010f9b5680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 15 QuartzCore 0x000000010f9e2767 _ZN2CA11Transaction6commitEv + 475 16 QuartzCore 0x000000010f9e30d7 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113 17 CoreFoundation 0x000000010cc88e17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 18 CoreFoundation 0x000000010cc88d87 __CFRunLoopDoObservers + 391 19 CoreFoundation 0x000000010cc6d4b6 CFRunLoopRunSpecific + 454 20 UIKit 0x000000010a5d47e6 -[UIApplication _run] + 434 21 UIKit 0x000000010a5da964 UIApplicationMain + 159 22 TodoList 0x0000000109924d0f main + 111 23 libdyld.dylib 0x000000010dbaa68d start + 1 24 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

swift

1// 2// ViewController.swift 3 4import UIKit 5 6class ViewController: UIViewController, UITableViewDelegate { 7 8 var items = ["1","2","3"] 9 10 override func viewDidLoad() { 11 super.viewDidLoad() 12 // Do any additional setup after loading the view, typically from a nib. 13 } 14 15 public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{ 16 17 return items.count 18 } 19 20 public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{ 21 22 let cell = UITableViewCell(style: .default, reuseIdentifier: "Cell") 23 24 cell.textLabel?.text = items[indexPath.row] 25 26 return cell 27 28 } 29 30 override func didReceiveMemoryWarning() { 31 super.didReceiveMemoryWarning() 32 // Dispose of any resources that can be recreated. 33 } 34 35 36} 37 38

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

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

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

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

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

guest

回答1

0

ベストアンサー

UITableViewDataSourceプロトコルが抜けてるのでを追加します。

swift

1class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

追加しないと↓がコールされません。

swift

1tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

投稿2016/12/15 20:15

fromageblanc

総合スコア2724

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

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

Tats.N

2016/12/15 20:47

なるほど。。UITableViewDataSourceを追加しないといけないんですね。。本当に助かりました。ありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問