线程 1:信号 SIGABRT Xcode 6.1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27712997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Thread 1: signal SIGABRT Xcode 6.1
提问by Zavax
I am running an application and in the AppDelegate class I am getting the error Thread 1: signal SIGABRT on the line stating class AppDelegate: UIResponder, UIApplicationDelegate {
The error message says 2014-12-29 18:10:03.687 Iphone App Learning[1160:144441] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Iphone_App_Learning.ViewController 0x7fcd58f0e270> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key TextField.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ad96f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c8dabb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010ad96b79 -[NSException raise] + 9
3 Foundation 0x000000010b1ae7b3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010ace0e80 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010b8e7c7d -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x000000010b746f98 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x000000010b747588 -[UIViewController loadView] + 109
8 UIKit 0x000000010b7477f9 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x000000010b747c8e -[UIViewController view] + 27
10 UIKit 0x000000010b666ca9 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x000000010b667041 -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x000000010b67372c -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x000000010b61e061 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628
14 UIKit 0x000000010b620d2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350
15 UIKit 0x000000010b61fbf2 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x000000010e4672a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
17 CoreFoundation 0x000000010accc53c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x000000010acc2285 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x000000010acc2045 __CFRunLoopRun + 2389
20 CoreFoundation 0x000000010acc1486 CFRunLoopRunSpecific + 470
21 UIKit 0x000000010b61f669 -[UIApplication _run] + 413
22 UIKit 0x000000010b622420 UIApplicationMain + 1282
23 Iphone App Learning 0x000000010abb197e top_level_code + 78
24 Iphone App Learning 0x000000010abb19ba main + 42
25 libdyld.dylib 0x000000010d0b4145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
The AppDelegate class looks like this `import UIKit
我正在运行一个应用程序,在 AppDelegate 类中,我收到错误 Thread 1: signal SIGABRT 在线声明class AppDelegate: UIResponder, UIApplicationDelegate {
The error message says 2014-12-29 18:10:03.687 Iphone App Learning[1160:144441] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Iphone_App_Learning.ViewController 0x7fcd58f0e270> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key TextField.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ad96f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c8dabb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010ad96b79 -[NSException raise] + 9
3 Foundation 0x000000010b1ae7b3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010ace0e80 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010b8e7c7d -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x000000010b746f98 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x000000010b747588 -[UIViewController loadView] + 109
8 UIKit 0x000000010b7477f9 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x000000010b747c8e -[UIViewController view] + 27
10 UIKit 0x000000010b666ca9 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x000000010b667041 -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x000000010b67372c -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x000000010b61e061 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628
14 UIKit 0x000000010b620d2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350
15 UIKit 0x000000010b61fbf2 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x000000010e4672a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
17 CoreFoundation 0x000000010accc53c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x000000010acc2285 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x000000010acc2045 __CFRunLoopRun + 2389
20 CoreFoundation 0x000000010acc1486 CFRunLoopRunSpecific + 470
21 UIKit 0x000000010b61f669 -[UIApplication _run] + 413
22 UIKit 0x000000010b622420 UIApplicationMain + 1282
23 Iphone App Learning 0x000000010abb197e top_level_code + 78
24 Iphone App Learning 0x000000010abb19ba main + 42
25 libdyld.dylib 0x000000010d0b4145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
AppDelegate 类看起来像这样`import UIKit
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
@UIApplicationMain 类 AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
And the view controller looks like this
import UIKit
}
And the view controller looks like this
进口的UIKit
class ViewController: UIViewController {
类视图控制器:UIViewController {
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.
}
} ` I am testing this in the simulator could this not be working because I don't have an iOS developer program?
` 我正在模拟器中测试这个,这会不会因为我没有 iOS 开发者程序而无法工作?
回答by Brad Brighton
Looks like you have a lingering connection to a no-longer-existent outlet. Perhaps you deleted a textField that you previously set up?
看起来您与一个已不存在的插座之间存在着挥之不去的联系。也许您删除了之前设置的 textField?
Ctrl-/right-click on the File's Owner in the Xcode editor, look for a warning triangle. Clear that out (by deleting the connection or re-connecting it to the proper outlet) and you'll likely be good.
Ctrl-/右键单击 Xcode 编辑器中的 File's Owner,查找警告三角形。清除它(通过删除连接或将其重新连接到正确的插座),您可能会好起来。
回答by oppih
There maybe another cause here: you made a Outlet and then you changed its name or add another Outlet using a new name.
这里可能还有另一个原因:您创建了一个 Outlet,然后更改了它的名称或使用新名称添加了另一个 Outlet。
You can check it by this way:
您可以通过以下方式进行检查:
click on the Label or Button element you put in the Storyboard, look at the right side bar, find "Show the connections inspector" then you can find its connection.
单击您放在 Storyboard 中的 Label 或 Button 元素,查看右侧栏,找到“显示连接检查器”,然后您可以找到它的连接。
If you just made some mistakes with the connections, it will show you here.
如果您只是在连接上犯了一些错误,它会在此处显示。
For me, I created two connections with one Outlet, that's why I kept getting the error. After I removed one of the wrong conection, it compiled successfully.
对我来说,我用一个 Outlet 创建了两个连接,这就是我不断收到错误消息的原因。在我删除了错误的连接之一后,它编译成功。
回答by pirateKyle
In Main.storyboard
I selected my Text Field, then on the far right I have my Utilities
showing and selected Show the Connections inspector
. There in the Referencing Outlets
section I had two connections selected:
在Main.storyboard
我选择了我的文本字段,然后在最右边我有我的Utilities
显示并选择了Show the Connections inspector
. 在该Referencing Outlets
部分中,我选择了两个连接:
- a
number-View Controller
and - a
enterText-View Controller
.
- 一个
number-View Controller
和 - 一个
enterText-View Controller
。
I simply selected the x
marker on my enterText-View Controller
to delete it (because in my case I only wanted a number selection) and that fixed this problem for my case.
我只是选择了x
我的标记enterText-View Controller
来删除它(因为在我的情况下我只想要一个数字选择)并且为我的情况解决了这个问题。