53432

Thread 1: signal SIGABRT Xcode 6.1

Question:

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

@UIApplicationMain class 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 thisimport UIKit

class ViewController: 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?

Answer1:

Looks like you have a lingering connection to a no-longer-existent outlet. Perhaps you deleted a textField that you previously set up?

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.

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/seXO9.png" data-original="https://i.stack.imgur.com/seXO9.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Answer2:

There maybe another cause here: you made a Outlet and then you changed its name or add another Outlet using a new name.

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.

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.

Answer3:

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:

<ul><li>a number-View Controller and </li> <li>a enterText-View Controller.</li> </ul>

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.

Recommend