首先,我很抱歉这可能有点简单/ 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