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 trial

iOS

Thread 1: signal SIGABRT //Video: Introducing @property

I was doing the property video in the iOS development course. I was using the downloaded Xcode files and my coding looks exactly the same as his on the video.

I looked over it multiple times and just messed around changing small things to see if I can solve the problem, but I still don't understand how I continue to get this instead of a normal output.

2014-11-29 17:04:07.354 MyFirstObjectiveCProgram[4616:479407] -[Sphere setRadius:]: unrecognized selector sent to instance 0x600000023240 2014-11-29 17:04:07.356 MyFirstObjectiveCProgram[4616:479407] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Sphere setRadius:]: unrecognized selector sent to instance 0x600000023240' *** First throw call stack: ( 0 CoreFoundation 0x00007fff961b164c exceptionPreprocess + 172 1 libobjc.A.dylib 0x00007fff97fbe6de objc_exception_throw + 43 2 CoreFoundation 0x00007fff961b46bd -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x00007fff960fba84 ___forwarding_ + 1028 4 CoreFoundation 0x00007fff960fb5f8 _CF_forwarding_prep_0 + 120 5 MyFirstObjectiveCProgram 0x0000000100000def main + 111 6 libdyld.dylib 0x00007fff98f9e5c9 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

If you can provide your code here, that would be more helpful.

"Unrecognised selector sent to instance" error is thrown when you try to call a method that doesn't exist. I understand you are trying to set a property.

At [Sphere setRadius:], is Sphere name of an instance variable or name of a class itself ?

Make sure you call the setter of the property using an instance.

Main.m

import <Cocoa/Cocoa.h>

import "Sphere.h"

int main() { Sphere *ball = [[Sphere alloc] init];

ball.radius = 34;
NSLog(@"ball radius %f", ball.radius);

return 0;

}

Sphere.h

import <Foundation/Foundation.h>

@interface Sphere : NSObject

@property(nonatomic) float radius; @property(nonatomic, strong) NSArray *center;

-(void)setCenter:(NSArray *)center radius:(float)radius; @end

Sphere.m

import "Sphere.h"

@implementation Sphere

-(void)setCenter:(NSArray *)center radius:(float)radius { _center = center; _radius = radius;

} @end

1 Answer

I still have this problem. I tried my best to enter the code in for main and the headers, but it came out cluttered. I had already continued on and didn't run into this problem again, but for learning and knowledge purposes I'd still like to know what I did wrong in case it happens again in the future.