Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeanne Merle
3,390 Points[SOLVED] Thread 1: signal SIGABRT
Hi, My Code did run perfectly during the course, but at the end, when Pasan asked to modify the AppDelegate class, it did not anymore, with the warning "Thread 1: signal SIGABRT"
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
application.setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false)
return true
}
I don't know what to do, where to look, what is wrong ... Can you help me ? Thanks !
9 Answers
Jeanne Merle
3,390 PointsSteve, I had an "Orphan Outlet" : I just understood by viewing the next course "Exception Breakpoints". I wanted to associate some code to the toolbar, and then created an outlet in swift code. I deleted the code, but not the association , because I did not know this link existed somewhere else ! Now everything works perfectly again ...
Thanks again for your concern !
Steve Hunter
57,712 PointsYour code in the didFinishLaunchingWithOptions
is very different to the video - I don't know if that's the problem and wouldn't recommend changing it, either.
In Xcode, do you get any other error messages in the bottom of the screen? There should be some sort of crash report - let us have the text in there.
Steve.
Jeanne Merle
3,390 PointsWell, first the code of the course was a little bit different from the code automatically provided in my Xcode AppDelegate.swift. Probably due to a different version of Xcode. Parson asked us to modify the code, so did I. And now my whole project won't work anymore, even when I delete the extra code !
Second, there's this line in the debug console : libc abi.dylib: terminating with uncaught exception of type NSException that is simply Chinese for me. No indication what is wrong, what I must do ...
Thanx Steve
Steve Hunter
57,712 PointsThe code can change from release to release as Xcode develops, yes. But the AppDelegate stuff is application specific. The amendments Pasan suggested are fine, obviously! They just make it look a bit nicer.
Is there anything else in the debug console? The app is throwing an error and not handling it, so it is crashing. The console may be of more use if there's more text in there. Open up both sides of the lower pane and copy the text into here.
Let's try that first before we start copying the code over.
Jeanne Merle
3,390 PointsOh sorry, I didn't paste everything :
2015-04-05 15:49:07.903 FunFacts[4401:146601] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FunFacts.ViewController 0x7fb982c39cc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key statusBar.' *** First throw call stack: ( 0 CoreFoundation 0x0000000107904a75 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010945cbb7 objc_exception_throw + 45 2 CoreFoundation 0x00000001079046b9 -[NSException raise] + 9 3 Foundation 0x0000000107d1fd43 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259 4 CoreFoundation 0x000000010784e5e0 -[NSArray makeObjectsPerformSelector:] + 224 5 UIKit 0x000000010845e4ed -[UINib instantiateWithOwner:options:] + 1506 6 UIKit 0x00000001082bca88 -[UIViewController _loadViewFromNibNamed:bundle:] + 242 7 UIKit 0x00000001082bd078 -[UIViewController loadView] + 109 8 UIKit 0x00000001082bd2e9 -[UIViewController loadViewIfRequired] + 75 9 UIKit 0x00000001082bd77e -[UIViewController view] + 27 10 UIKit 0x00000001081dc509 -[UIWindow addRootViewControllerViewIfPossible] + 58 11 UIKit 0x00000001081dc8a1 -[UIWindow _setHidden:forced:] + 247 12 UIKit 0x00000001081e8f8c -[UIWindow makeKeyAndVisible] + 42 13 UIKit 0x00000001081930c2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732 14 UIKit 0x0000000108195e3e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349 15 UIKit 0x0000000108194d35 -[UIApplication workspaceDidEndTransaction:] + 179 16 FrontBoardServices 0x000000010b00e243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16 17 CoreFoundation 0x0000000107839c7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12 18 CoreFoundation 0x000000010782f9c5 __CFRunLoopDoBlocks + 341 19 CoreFoundation 0x000000010782f785 __CFRunLoopRun + 2389 20 CoreFoundation 0x000000010782ebc6 CFRunLoopRunSpecific + 470 21 UIKit 0x00000001081947a2 -[UIApplication _run] + 413 22 UIKit 0x0000000108197580 UIApplicationMain + 1282 23 FunFacts 0x0000000107722bbe top_level_code + 78 24 FunFacts 0x0000000107722bfa main + 42 25 libdyld.dylib 0x0000000109c38145 start + 1 26 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
Steve Hunter
57,712 PointsThere's the reason for it:
'[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key statusBar.'
Now, to figure out how to fix it!!
The video made you make changes to the Info
section in the project properties - can you remember what they were and have you checked that you got it right? Did you add the 'View controller-based status bar'?
One thing, humour me on this as it is a shot in the dark - in your AppDelegate, change [NSObject: AnyObject]?
to NSDictionary!
. That's after launchOptions
. Leave the rest as it is and give that a go. Let's see if we get a different error as that might help track down the problem.
Do you have a Github account? That's an easy way to share code and collaborate to find solutions. I think it would help to be able to see the code in an Xcode project.
Steve.
Jeanne Merle
3,390 PointsOk I have replaced the View controller-based status bar" to a new one. I have changed [NSObject: AnyObject]? to NSDictionary! And now my App is totally Black :-) That's ... different ! The only thing I can see is the top bar, with power, hour ... The rest of the screen is black, and nothing happens when I click all over.
I have no Github account, but I m not a professional yet : i could afford myself a Apple Computer (like we said in France, is cost me an eye), and Tree House courses, but I must figure out where I 'm going with my skills and my apps before going further and spending more money ...
Steve Hunter
57,712 PointsWeird! I'd suggest changing the 'View controller-based' thing back. See what that does with just the Dictionary
as a change.
At least this isn't crashing now which, I suppose, is progress of sorts!!
Github is free - no payment required and it is one of the most useful things! For example, in this scenario you would have committed your work at each stage. When the error appeared, you can branch outwards to fix the issue or roll back to before the problem existed. You can also share with other people who can amend the code - any changes they make, you decide whether to allow them into your app. I'd highly recommend it - version control is important.
Steve Hunter
57,712 PointsHa! That's so easily done, it is annoying!
Glad you get sorted.
Steve.
Samar Khanna
1,757 PointsI have the same problem and i don't know what to do My error started when i added the random colour thing
Samar Khanna
1,757 PointsSamar Khanna
1,757 PointsHow did u do that?