首先,我很抱歉這可能有點簡單/ noobish的問題。 但是,我一直在試圖調試這個錯誤很長一段時間了。不幸的是,我最近開始使用Xcode並使用Swift。信號sigabrt委託 - > AppDelegate.swift
我一直在關注在線課程Udemy的教程。 然而,在插入代碼之後,我不斷收到此錯誤:
Thread1: Signal SIGABRT
不知道什麼是可能。我一直在尋找對谷歌 https://teamtreehouse.com/community/error-message-thread-1-signal-sigabrt-in-class-appdelegate
但這並沒有解決我的問題:(
此外,它是很難理解究竟是什麼發生的事情,所以我找不到通過谷歌一個很好的解決方案。也許你可以幫我出
class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate {
@IBOutlet weak var statePicker: UIPickerView!
@IBOutlet weak var statePickerBtn: UIButton!
let states = ["Alaska","Arkansas","Alabama","California","New York"]
override func viewDidLoad() {
super.viewDidLoad()
self.statePicker.dataSource = self
statePicker.delegate = self
// 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.
}
@IBAction func stateBtnPressed(_ sender: AnyObject) {
statePickerBtn.isHidden = false
}
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return states.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return states[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
statePickerBtn.setTitle(states[row], for: UIControlState.application)
statePicker.isHidden = true
}
什麼是我想要做的事:。 我有隱藏着一個選擇器,當用戶按下按鈕,我希望它能夠揭示選取器用戶一旦該事件點擊,他們會看到數組中的選擇器,那麼,你知道我的意思,但是當我構建它時,他模擬器仍然是白色的,Xcode提示我到AppDelegate.Swift出現這個特定的錯誤。
TNX
Print screen of the error after I pressed Run. + Output, sorry for messy prnt scrn :)
控制檯輸出:
2017-03-01 18:03:39.717795 myPillsNoob[969:17168] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2017-03-01 18:03:39.725996 myPillsNoob[969:17168] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2017-03-01 18:03:39.738908 myPillsNoob[969:17165] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2017-03-01 18:03:39.760737 myPillsNoob[969:17069] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2017-03-01 18:03:39.849 myPillsNoob[969:17069] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<myPillsNoob.ViewController 0x7fa24ce09160> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key stateButtonPressed.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001132e234b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011038f21e objc_exception_throw + 48
2 CoreFoundation 0x00000001132e2299 -[NSException raise] + 9
3 Foundation 0x000000010fe9f2ff -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x00000001109f88c3 -[UIViewController setValue:forKey:] + 88
5 UIKit 0x0000000110c6cbe6 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000113287590 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x0000000110c6b56a -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x00000001109feff5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9 UIKit 0x00000001109ff917 -[UIViewController loadView] + 177
10 UIKit 0x00000001109ffc4c -[UIViewController loadViewIfRequired] + 201
11 UIKit 0x0000000110a004a0 -[UIViewController view] + 27
12 UIKit 0x00000001108ca045 -[UIWindow addRootViewControllerViewIfPossible] + 71
13 UIKit 0x00000001108ca796 -[UIWindow _setHidden:forced:] + 293
14 UIKit 0x00000001108de0a9 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x0000000110857259 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818
16 UIKit 0x000000011085d3b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
17 UIKit 0x000000011085a539 -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x000000011477b76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
19 FrontBoardServices 0x000000011477b5e4 -[FBSSerialQueue _performNext] + 189
20 FrontBoardServices 0x000000011477b96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x0000000113287311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x000000011326c59c __CFRunLoopDoSources0 + 556
23 CoreFoundation 0x000000011326ba86 __CFRunLoopRun + 918
24 CoreFoundation 0x000000011326b494 CFRunLoopRunSpecific + 420
25 UIKit 0x0000000110858db6 -[UIApplication _run] + 434
26 UIKit 0x000000011085ef34 UIApplicationMain + 159
27 myPillsNoob 0x000000010fdb071f main + 111
28 libdyld.dylib 0x0000000113fe568d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
還有什麼更多 - 控制檯或Xcode - 來幫助我們嗎?這是一個非常普遍的錯誤。但是,錯誤的細節應該指向這個問題。 – dfd
我在哪裏可以找到你所需要的?控制檯保持空着。我習慣在Visual Studio中編寫軟件,並在兩天前開始使用Xcode。有點困惑 – Niklaus
我寫了VS約15年,直到2015年,所以我明白你的痛苦。 :-)我假設Xcode不會「停止」一行代碼。 (如果是,請指出哪一行。)除此之外,還有兩件事:(1)菜單選項查看|調試區域|激活控制檯。 (2)直接點擊左側欄中的SIGABRT錯誤。 (你會看到一個非常混亂的轉儲,但它會有所幫助。) – dfd