Xcode9.4.1
Swift4
ストーリーボードでは正しくコネクトしています。
buttomをクリックすると次のページに遷移する予定だったのですが、クリックするとThread 1: signal SIGABRTエラーになります。
コンソールには、
libc++abi.dylib: terminating with uncaught exception of type NSException
と表示されています。
流れとしては、ViewController.swift→NewViewControllerに画面遷移です。
昨日までは画面遷移できていたのに、今日次のページの作業をしている途中に遷移しなくなりました。
すみませんがエラーの原因を教えていただきたいです。
どこが原因でエラーが出ているのかわからない状態なので、関係ありそうな所を全て載せています。
エラーが出たのはAppDelegate.swiftの中で、画面遷移しようとした元のページはViewController.swiftです。
よろしくお願いいたします。
エラーが出ていた場所
AppDelegate.swift
import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { **←ここに出ていました。** var window: UIWindow?
ViewController.swift
import UIKit class ViewController: UIViewController { @IBOutlet weak var cTabBar: UITabBar! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } //スイカの子役カウンター @IBOutlet weak var sgoukei: UILabel! @IBAction func spuramai(_ sender: UIStepper) { let num = Int(sender.value) sgoukei.text = String(num) } //チェリーの子役カウンター @IBOutlet var tgoukei: UILabel! @IBAction func tpuramai(_ sender: UIStepper) { let num1 = Int(sender.value) tgoukei.text = String(num1) } //ベルの子役カウンター @IBOutlet var bgoukei: UILabel! @IBAction func bpuramai(_ sender: UIStepper) { let num2 = Int(sender.value) bgoukei.text = String(num2) } //チャンス目Aの子役カウンター @IBOutlet var tAgoukei: UILabel! @IBAction func tApuramai(_ sender: UIStepper) { let num3 = Int(sender.value) tAgoukei.text = String(num3) } //チャンス目Bの子役カウンター @IBOutlet var tBgoukei: UILabel! @IBAction func tBpuramai(_ sender: UIStepper) { let num4 = Int(sender.value) tBgoukei.text = String(num4) } }
NewViewController.swift
import UIKit class NewViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBOutlet weak var tenpomei: UILabel! /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ }
コンソールの画面です
2018-09-12 14:38:36.859928+0900 newfile[24282:3136946] -[newfile.NewViewController numberOfComponentsInPickerView:]: unrecognized selector sent to instance 0x7fee82c134f0 2018-09-12 14:38:36.864838+0900 newfile[24282:3136946] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[newfile.NewViewController numberOfComponentsInPickerView:]: unrecognized selector sent to instance 0x7fee82c134f0' *** First throw call stack: ( 0 CoreFoundation 0x0000000104ec81e6 __exceptionPreprocess + 294 1 libobjc.A.dylib 0x000000010132e031 objc_exception_throw + 48 2 CoreFoundation 0x0000000104f49784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 UIKit 0x0000000101df86db -[UIResponder doesNotRecognizeSelector:] + 295 4 CoreFoundation 0x0000000104e4a898 ___forwarding___ + 1432 5 CoreFoundation 0x0000000104e4a278 _CF_forwarding_prep_0 + 120 6 UIKit 0x0000000101baa823 -[UIPickerView _delegateNumberOfComponents] + 55 7 UIKit 0x0000000101ba9947 -[UIPickerView _updateSelectedRows] + 91 8 UIKit 0x0000000101ba9a15 -[UIPickerView didMoveToWindow] + 101 9 UIKit 0x0000000101c8fef5 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1718 10 UIKit 0x0000000101c8fb38 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 761 11 UIKit 0x0000000101c820b4 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151 12 UIKit 0x0000000101c81f8a -[UIView(Hierarchy) _postMovedFromSuperview:] + 808 13 UIKit 0x0000000101c929cb -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1940 14 UIKit 0x0000000101d391a6 -[UITransitionView transition:fromView:toView:removeFromView:] + 1371 15 UIKit 0x000000010297405a -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 2056 16 UIKit 0x0000000101d3f68e __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 3033 17 UIKit 0x0000000101bd54b3 _runAfterCACommitDeferredBlocks + 318 18 UIKit 0x0000000101bc471e _cleanUpAfterCAFlushAndRunDeferredBlocks + 388 19 UIKit 0x0000000101bf2ea5 _afterCACommitHandler + 137 20 CoreFoundation 0x0000000104e6a607 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 21 CoreFoundation 0x0000000104e6a55e __CFRunLoopDoObservers + 430 22 CoreFoundation 0x0000000104e4eb81 __CFRunLoopRun + 1537 23 CoreFoundation 0x0000000104e4e30b CFRunLoopRunSpecific + 635 24 GraphicsServices 0x00000001077c0a73 GSEventRunModal + 62 25 UIKit 0x0000000101bca057 UIApplicationMain + 159 26 newfile 0x0000000100a20567 main + 55 27 libdyld.dylib 0x00000001060a9955 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
回答1件
あなたの回答
tips
プレビュー