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)
回答1件
あなたの回答
tips
プレビュー