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

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

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

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

Swift

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

Q&A

解決済

1回答

2263閲覧

[Swift4.0]XcodeでUITextFieldを追加するとThread 1: signal SIGABRT が発生する

KKK_

総合スコア29

Xcode

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

Swift

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

0グッド

0クリップ

投稿2017/10/19 02:17

編集2017/10/19 02:44

アプリケーションはViewController1(以下画面1)でDBから検索を行い結果をViewController2(以下画面2)に一覧で表示するというものです。
無条件で画面1の検索を押下すると画面2に結果を表示するところまでは完成しています。

次に画面1にUITextFieldを配置しOutletsの設定を行い実行後、
UITextFieldに検索文字を入力し検索を押下すると画面2のLoad箇所で
添付イメージのようなエラーとなります。

色々調べてみてOutletsの設定ができていない時に発生することが多いということですが問題なさそうです。
確認すべき点をご教示ください。

イメージ説明

エラー

2017-10-19 11:41:20.299098+0900 PetKarte[6217:420996] *** Assertion failure in -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3694.4.18/Keyboard/UIKeyboardTaskQueue.m:433 2017-10-19 11:41:20.381193+0900 PetKarte[6217:420996] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.' *** First throw call stack: ( 0 CoreFoundation 0x000000010fe691cb __exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010f7cbf41 objc_exception_throw + 48 2 CoreFoundation 0x000000010fe6e362 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000010f270089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 UIKit 0x0000000111048bd5 -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 380 5 UIKit 0x00000001105d8682 -[UIKeyboardImpl setDelegate:force:] + 1596 6 UIKit 0x0000000110abd916 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1054 7 UIKit 0x0000000110ac6d84 -[UIPeripheralHost(UIKitInternal) _preserveInputViewsWithId:animated:reset:] + 498 8 UIKit 0x000000011049391e -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1119 9 UIKit 0x00000001104956ab -[UIViewController _presentViewController:withAnimationController:completion:] + 4621 10 UIKit 0x00000001104981c1 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99 11 UIKit 0x0000000110498891 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532 12 UIKit 0x0000000110498120 -[UIViewController _presentViewController:animated:completion:] + 181 13 UIKit 0x000000011049847f -[UIViewController presentViewController:animated:completion:] + 159 14 UIKit 0x000000011049d802 -[UIViewController _showViewController:withAction:sender:] + 274 15 UIKit 0x0000000110a3dfbc __66-[UIStoryboardShowSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 134 16 UIKit 0x0000000110bfb903 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 279 17 UIKit 0x0000000110bfb7bb -[UIStoryboardSegueTemplate _perform:] + 82 18 UIKit 0x0000000110484b84 -[UIViewController performSegueWithIdentifier:sender:] + 99 19 PetKarte 0x000000010eea4370 _T08PetKarte19firstViewControllerC12uButtonTouchyypFy10Foundation4DataVSg_So11URLResponseCSgs5Error_pSgtcfU_ + 896 20 PetKarte 0x000000010eea481a _T08PetKarte19firstViewControllerC12uButtonTouchyypFy10Foundation4DataVSg_So11URLResponseCSgs5Error_pSgtcfU_TA + 90 21 PetKarte 0x000000010ee9e5e7 _T010Foundation4DataVSgSo11URLResponseCSgs5Error_pSgIxxxx_So6NSDataCSgAGSo7NSErrorCSgIyByyy_TR + 263 22 CFNetwork 0x00000001135fe208 __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 19 23 CFNetwork 0x00000001135fda6d __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 147 24 Foundation 0x000000010f1e29b7 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7 25 Foundation 0x000000010f1e281a -[NSBlockOperation main] + 68 26 Foundation 0x000000010f1e0cd6 -[__NSOperationInternal _start:] + 778 27 libdispatch.dylib 0x000000011423943c _dispatch_client_callout + 8 28 libdispatch.dylib 0x000000011423eaf4 _dispatch_block_invoke_direct + 592 29 libdispatch.dylib 0x000000011423943c _dispatch_client_callout + 8 30 libdispatch.dylib 0x000000011423eaf4 _dispatch_block_invoke_direct + 592 31 libdispatch.dylib 0x000000011423e884 dispatch_block_perform + 109 32 Foundation 0x000000010f1dcce4 __NSOQSchedule_f + 342 33 libdispatch.dylib 0x000000011423943c _dispatch_client_callout + 8 34 libdispatch.dylib 0x000000011423f856 _dispatch_continuation_pop + 967 35 libdispatch.dylib 0x000000011423dc86 _dispatch_async_redirect_invoke + 780 36 libdispatch.dylib 0x00000001142451f9 _dispatch_root_queue_drain + 772 37 libdispatch.dylib 0x0000000114244e97 _dispatch_worker_thread3 + 132 38 libsystem_pthread.dylib 0x00000001146fc5a2 _pthread_wqthread + 1299 39 libsystem_pthread.dylib 0x00000001146fc07d start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException

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

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

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

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

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

fuzzball

2017/10/19 02:21

「問題なさそうです」の根拠を書いて下さい。あと、落ちたときConsoleには何か表示されていませんか?
KKK_

2017/10/19 02:33

根拠はViewControllerの黄色い丸を右クリックしてもエラーにはなっていないということからです。対象のText右クリックでもReferencing Outlet Collectionsのところにも画面1と紐付けされている状態です。添付画像の通りConsoleには何も表示されません。
KKK_

2017/10/19 02:44

失礼いたしました。エラーが出ていました。
fuzzball

2017/10/19 02:45

添付画像にConsoleは表示されていません。(表示されているのはVariables Viewです)
guest

回答1

0

ベストアンサー

画面2への遷移をメインスレッド外で行っていないでしょうか?
メインスレッドで遷移するようにして下さい。

swift

1DispatchQueue.main.async { 2 //遷移 3}

メインスレッドかどうかはprint(Thread.isMainThread)で確認できます。

投稿2017/10/19 02:52

fuzzball

総合スコア16731

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

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

KKK_

2017/10/19 03:58

まさにご指摘通りメインスレッドで処理することで解決しました。 ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問