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

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

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

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

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

Swift

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

Q&A

解決済

1回答

1689閲覧

Thread 1: signal SIGABRTで画面遷移ができない

退会済みユーザー

退会済みユーザー

総合スコア0

iOS

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

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

Swift

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

0グッド

1クリップ

投稿2020/03/15 09:44

xcode 11.3 beta
Swift 5.1.3

buttomをタップして次のページに遷移する予定なのですが、クリックするとThread 1: signal SIGABRTエラーになります。

コンソールには、libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
と表示されます。

いろんな記事を見ていくつかの方法を試しましたが、どれもうまくいきませんでした。
エラーが出る原因を教えていただきたいです。宜しくお願いします。

エラーの箇所
AppDelegate.swift

swift

1import UIKit 2 3//↓ここです。 4@UIApplicationMain 5class AppDelegate: UIResponder, UIApplicationDelegate { 6 7 8 9 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 10 // Override point for customization after application launch. 11 return true 12 }

遷移元
ViewController

swift

1import UIKit 2 3class ViewController: UIViewController { 4 var count = 5 5 6 7 8 viewDidLoad 9 override func viewDidLoad() { 10 super.viewDidLoad() 11 12 aaaa() 13 count = 10 14 15 } 16 17 func aaaa() { 18 19 } 20 21 @IBAction func tap(_ sender: AnyObject) { 22 23 } 24 25 26} 27

遷移先
secondViewController

swift

1import UIKit 2 3class secondViewController: UIViewController { 4 5 @IBOutlet weak var changeLabel: UILabel! 6 7 override func viewDidLoad() { 8 super.viewDidLoad() 9 10 11 12 13 // Do any additional setup after loading the view. 14 } 15 16 @IBAction func change(_ sender: Any) { 17 changeLabel.text = "change" 18 19 }

コンソール画面です。

2020-03-15 18:20:32.443130+0900 fujiiButton[1483:184788] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<fujiiButton.secondViewController 0x7f9b86610750> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key changeLavel.' *** First throw call stack: ( 0 CoreFoundation 0x00007fff23c9b27e __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff516b6b20 objc_exception_throw + 48 2 CoreFoundation 0x00007fff23c9ae49 -[NSException raise] + 9 3 Foundation 0x00007fff2579fee3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 325 4 UIKitCore 0x00007fff47cd50b9 -[UIViewController setValue:forKey:] + 87 5 UIKitCore 0x00007fff47fc5aba -[UIRuntimeOutletConnection connect] + 109 6 CoreFoundation 0x00007fff23c872a2 -[NSArray makeObjectsPerformSelector:] + 242 7 UIKitCore 0x00007fff47fc2c62 -[UINib instantiateWithOwner:options:] + 2190 8 UIKitCore 0x00007fff47cdc59a -[UIViewController _loadViewFromNibNamed:bundle:] + 395 9 UIKitCore 0x00007fff47cdd0bf -[UIViewController loadView] + 177 10 UIKitCore 0x00007fff47cdd3be -[UIViewController loadViewIfRequired] + 172 11 UIKitCore 0x00007fff47cddb6b -[UIViewController view] + 27 12 UIKitCore 0x00007fff47bf5cff -[_UIFullscreenPresentationController _setPresentedViewController:] + 84 13 UIKitCore 0x00007fff47be8eb5 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 184 14 UIKitCore 0x00007fff47ceed44 -[UIViewController _presentViewController:withAnimationController:completion:] + 3509 15 UIKitCore 0x00007fff47cf190f __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 98 16 UIKitCore 0x00007fff47cf1e27 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511 17 UIKitCore 0x00007fff47cf186d -[UIViewController _presentViewController:animated:completion:] + 187 18 UIKitCore 0x00007fff47cf1ad4 -[UIViewController presentViewController:animated:completion:] + 150 19 UIKitCore 0x00007fff484bd891 __74-[UIStoryboardPresentationSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 133 20 UIKitCore 0x00007fff484c3668 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 276 21 UIKitCore 0x00007fff484c3526 -[UIStoryboardSegueTemplate _perform:] + 82 22 UIKitCore 0x00007fff484c37e8 -[UIStoryboardSegueTemplate perform:] + 157 23 UIKitCore 0x00007fff4835d7a3 -[UIApplication sendAction:to:from:forEvent:] + 83 24 UIKitCore 0x00007fff47d35902 -[UIControl sendAction:to:forEvent:] + 223 25 UIKitCore 0x00007fff47d35c4c -[UIControl _sendActionsForEvents:withEvent:] + 398 26 UIKitCore 0x00007fff47d34bab -[UIControl touchesEnded:withEvent:] + 481 27 UIKitCore 0x00007fff48398363 -[UIWindow _sendTouchesForEvent:] + 2604 28 UIKitCore 0x00007fff48399c6a -[UIWindow sendEvent:] + 4596 29 UIKitCore 0x00007fff48374cdf -[UIApplication sendEvent:] + 356 30 UIKitCore 0x00007fff483f5ebe __dispatchPreprocessedEventFromEventQueue + 6847 31 UIKitCore 0x00007fff483f8984 __handleEventQueueInternal + 5980 32 CoreFoundation 0x00007fff23bfe471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 33 CoreFoundation 0x00007fff23bfe39c __CFRunLoopDoSource0 + 76 34 CoreFoundation 0x00007fff23bfdb74 __CFRunLoopDoSources0 + 180 35 CoreFoundation 0x00007fff23bf887f __CFRunLoopRun + 1263 36 CoreFoundation 0x00007fff23bf8066 CFRunLoopRunSpecific + 438 37 GraphicsServices 0x00007fff38825bb0 GSEventRunModal + 65 38 UIKitCore 0x00007fff4835c4f1 UIApplicationMain + 1621 39 fujiiButton 0x000000010ce677bb main + 75 40 libdyld.dylib 0x00007fff52539c25 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

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

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

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

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

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

hoshi-takanori

2020/03/15 10:03

Storyboard または xib ファイルがおかしい(ViewController のクラスを secondViewController にしてないとか)のでは。 あと、secondViewController のクラス名の最初の字は大文字(つまり SecondViewController)にしましょう。
退会済みユーザー

退会済みユーザー

2020/03/15 12:23

解決できました(泣)ありがとうございます。。。。
guest

回答1

0

ベストアンサー

まずは切り分けてはどうでしょうか。
コードを見る限り特に何かをしているわけではないようですが、画面遷移がViewControllerからSecondViewControllerになるようですが、IBActionでtap()メソッドが指定されていますが、これって実はストーリボード上で2番目に遷移するようにアクションを登録していたりしませんか?
なんとなくそのあたりな気がするのです。
このtap()メソッドを削除したらエラーが無くなったらそれだと思います。
外してたらすみません。

投稿2020/03/15 16:31

freemann

総合スコア264

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問