Reputation: 77
I am currently creating a fitness app for the iPhone through Xcode. It has three different view controllers and a file attached to each one. I am currently working in the second view controller with the second file, and I have currently just added four IB outlets to the code and a IB action for a button. However, when I run the code, it freezes in the simulator and takes me back to a screen with the AppDelegate class, and it has a red area that says Signal Sigabrt. When I remove all of the outlets and actions, the program runs fine and everything works perfectly, but when I add even one outlet, the simulator freezes again and the Signal Sigabrt comes back again. I read online in many other posts that this is because of a connection problem between the elements and the outlets and actions, so I deleted the action and outlets through the Connections Inspector and I reconnected everything again. However, this did not solve anything, and I am still stuck with the same Signal Sigabrt problem. I looked through what the Debugger was giving me and it says that the Breakfast1
outlet is wrong, so I removed that outlet through the Connections inspector and ran the program again, but it just keeps on telling me that the next outlet is wrong and it gives me the Signal Sigabrt again. Has anybody else had this issue and can help me solve it?
My ViewController2 Code:
import UIKit
class ViewController2: UIViewController {
@IBOutlet weak var Breakfast1: UITextField!
@IBOutlet weak var Lunch1: UITextField!
@IBOutlet weak var Dinner1: UITextField!
@IBOutlet weak var Total1: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
/
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
/
}
@IBAction func addingButton(_ sender: Any) {
}
}
What the Debug area is giving me:
2017-12-28 14:06:03.645843-0700 Fitness App FBLA[96716:47605553] Unknown class ViewController2 in Interface Builder file.
2017-12-28 14:06:03.658340-0700 Fitness App FBLA[96716:47605553] [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-12-28 14:06:03.659452-0700 Fitness App FBLA[96716:47605553] [MC] Loaded MobileCoreServices.framework
2017-12-28 14:06:03.692388-0700 Fitness App FBLA[96716:47605553] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/basketballboy03/Library/Developer/CoreSimulator/Devices/8342977F-88AA-474E-BDEB-EAABE8007D1C/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-12-28 14:06:03.749797-0700 Fitness App FBLA[96716:47605553] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fa6e3417c40> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Breakfast1.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010cd4b1ab __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001090f3f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010cd4b0f9 -[NSException raise] + 9
3 Foundation 0x0000000108b161e3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x0000000109b2d777 -[UIViewController setValue:forKey:] + 87
5 UIKit 0x0000000109e1ccb1 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010ccee4fd -[NSArray makeObjectsPerformSelector:] + 317
7 UIKit 0x0000000109e1b667 -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x0000000109b34838 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
9 UIKit 0x0000000109b35164 -[UIViewController loadView] + 177
10 UIKit 0x0000000109b35495 -[UIViewController loadViewIfRequired] + 195
11 UIKit 0x0000000109b35cf2 -[UIViewController view] + 27
12 UIKit 0x000000010a5c53a9 -[_UIFullscreenPresentationController _setPresentedViewController:] + 89
13 UIKit 0x0000000109b03ba7 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
14 UIKit 0x0000000109b48f6a -[UIViewController _presentViewController:withAnimationController:completion:] + 3808
15 UIKit 0x0000000109b4bdad __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
16 UIKit 0x0000000109b4c47d -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
17 UIKit 0x0000000109b4bd0c -[UIViewController _presentViewController:animated:completion:] + 181
18 UIKit 0x0000000109b4c06b -[UIViewController presentViewController:animated:completion:] + 159
19 UIKit 0x000000010a297cbc __74-[UIStoryboardPresentationSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 133
20 UIKit 0x000000010a2b7dcb -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 279
21 UIKit 0x000000010a2b7c83 -[UIStoryboardSegueTemplate _perform:] + 82
22 UIKit 0x000000010a2b7f4b -[UIStoryboardSegueTemplate perform:] + 157
23 UIKit 0x0000000109992275 -[UIApplication sendAction:to:from:forEvent:] + 83
24 UIKit 0x0000000109b0f4a2 -[UIControl sendAction:to:forEvent:] + 67
25 UIKit 0x0000000109b0f7bf -[UIControl _sendActionsForEvents:withEvent:] + 450
26 UIKit 0x0000000109b0e6ec -[UIControl touchesEnded:withEvent:] + 618
27 UIKit 0x0000000109a07bbb -[UIWindow _sendTouchesForEvent:] + 2807
28 UIKit 0x0000000109a092de -[UIWindow sendEvent:] + 4124
29 UIKit 0x00000001099ace36 -[UIApplication sendEvent:] + 352
30 UIKit 0x000000010a2ef434 __dispatchPreprocessedEventFromEventQueue + 2809
31 UIKit 0x000000010a2f2089 __handleEventQueueInternal + 5957
32 CoreFoundation 0x000000010ccee231 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
33 CoreFoundation 0x000000010cd8de41 __CFRunLoopDoSource0 + 81
34 CoreFoundation 0x000000010ccd2b49 __CFRunLoopDoSources0 + 185
35 CoreFoundation 0x000000010ccd212f __CFRunLoopRun + 1279
36 CoreFoundation 0x000000010ccd19b9 CFRunLoopRunSpecific + 409
37 GraphicsServices 0x000000010f4b39c6 GSEventRunModal + 62
38 UIKit 0x00000001099905e8 UIApplicationMain + 159
39 Fitness App FBLA 0x00000001087dcbf7 main + 55
40 libdyld.dylib 0x000000010de77d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Upvotes: 1
Views: 389
Reputation: 1
I had the same issue. But when I created a new cocoa file and added it to the ViewController it was resolved. It seems that the file was corrupted because it would bee keep on adding those gray circles on the side of the code after running it.
Upvotes: 0
Reputation: 808
It looks like you have not set the correct class for the view controller in Interface Builder.
With the view controller selected, in the right side of the Interface Builder in the Identity Inspector set the class to ViewController2 .
Upvotes: 2
Reputation: 53
Ok it looks like you might have renamed one of your outlets just using one of the Xcode editors, but this breaks the connection of your outlet to your actual button/label. To fix this you open your swift file that your having a problem with as source code and edit the name in there. This will fix your break between the IBOutlet. I hope this works lmk and I can help your further if it doesn't.
Conor
Upvotes: -1