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 trialStu Cowley
26,287 PointsBuild a Simple iPhone App - Using a Data Collection, Ugly Error (Thread 1: signal SIGABRT)
Hey guys,
I'm scooting along nicely with the Build a Simple iPhone App project until now. I have followed along with the videos perfectly and everything works just fine alas all good runs must come to an end.
I have no errors or warnings with my code and when I run the Fun Facts app, I get a Thread 1: signal SIGABRT error and the app crashes when I tap the "Show Another Fun Fact" button.
I have scratched my head and can't find away to fix this so I thought it's time to get on the forum.
Here is my code that I have done for the project along with the console log of the bug.
ViewContoller.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *funFactLabel;
@property (strong, nonatomic) NSArray *facts;
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.facts = [[NSArray alloc] initWithObjects:@"Ants stretch when they wake.", @"Ostriches can run faster than horses.", nil];
self.funFactLabel = [self.facts objectAtIndex:0];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)showFunFact {
self.funFactLabel.text = [self.facts objectAtIndex:1];
}
@end
Console Message
2015-05-17 01:19:17.586 FunFacts[2534:102474] -[__NSCFConstantString setText:]: unrecognized selector sent to instance 0x10203c
2015-05-17 01:19:17.589 FunFacts[2534:102474] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString setText:]: unrecognized selector sent to instance 0x10203c'
*** First throw call stack:
(
0 CoreFoundation 0x0095a746 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x005e3a97 objc_exception_throw + 44
2 CoreFoundation 0x00962705 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x008a9287 ___forwarding___ + 1047
4 CoreFoundation 0x008a8e4e _CF_forwarding_prep_0 + 14
5 FunFacts 0x00100840 -[ViewController showFunFact] + 176
6 libobjc.A.dylib 0x005f97cd -[NSObject performSelector:withObject:withObject:] + 84
7 UIKit 0x00d1aa90 -[UIApplication sendAction:to:from:forEvent:] + 99
8 UIKit 0x00d1aa22 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
9 UIKit 0x00e5b18a -[UIControl sendAction:to:forEvent:] + 69
10 UIKit 0x00e5b5a7 -[UIControl _sendActionsForEvents:withEvent:] + 598
11 UIKit 0x00e5a811 -[UIControl touchesEnded:withEvent:] + 660
12 UIKit 0x00d72cfa -[UIWindow _sendTouchesForEvent:] + 874
13 UIKit 0x00d737d6 -[UIWindow sendEvent:] + 792
14 UIKit 0x00d316d1 -[UIApplication sendEvent:] + 242
15 UIKit 0x00d41b08 _UIApplicationHandleEventFromQueueEvent + 21484
16 UIKit 0x00d15337 _UIApplicationHandleEventQueue + 2300
17 CoreFoundation 0x0087c06f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
18 CoreFoundation 0x00871b7d __CFRunLoopDoSources0 + 253
19 CoreFoundation 0x008710d8 __CFRunLoopRun + 952
20 CoreFoundation 0x00870a5b CFRunLoopRunSpecific + 443
21 CoreFoundation 0x0087088b CFRunLoopRunInMode + 123
22 GraphicsServices 0x03bc02c9 GSEventRunModal + 192
23 GraphicsServices 0x03bc0106 GSEventRun + 104
24 UIKit 0x00d19106 UIApplicationMain + 1526
25 FunFacts 0x00100d3a main + 138
26 libdyld.dylib 0x02ce6ac9 start + 1
27 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Don't know if it is due to a lack of caffine, but no doubt I have missed something dumb out, like the good old ;
Any advice or help on this would be greatly appreciated as I'm really enjoying this course and I'd rather be doing it than sitting idle looking for a fix.
Thanking you in advance,
Stu : D
Stu Cowley
26,287 PointsI re-assed my code against what Passan had done in the project and I have managed to get it to work, I think I may have put some code in the wrong spot, because it seems to be doing what it's meant to be doing now :)
Thanks for your help too Jeanne Merle! : )
2 Answers
Ayush Bhargava
791 Pointsthere was only one reference in my reference outlet called viewcontroler and i deleted it but when i tried it again it didn't work the same problem occurred it is almost the same as stu's
Emmanuel Darmon
6,115 PointsSame problem here but Jeanne Merle had the solution: Go to storyboard, right click on "Show another fun fact" and uncheck extra. It works fine now!
Jeanne Merle
3,390 PointsJeanne Merle
3,390 PointsTry to delete bad Referencing outlets : this caused me the same error than you.
For this, click on your MainStoryboard at the right of the screen, open the Utilities panel click on the right button "Show the connections inspector" (an arrow in a circle) then here check your references . Delete the ones you don't use anymore. Be careful to not delete the ones you use in your ViewController.swift.
Good Luck.