Re: Unable to access an instance properties and methods
Re: Unable to access an instance properties and methods
- Subject: Re: Unable to access an instance properties and methods
- From: Davide Benini <email@hidden>
- Date: Wed, 19 Mar 2008 18:00:43 +0100
You'd have won the bet.
For some reason I had a placed a NSString instead of a DBNNote into
the array; probably for debugging purposes...
Thanks a million, I had zero chaces of tracing this bug by myself, for
I thought the description was the appropriate one...
I owe you a pint,
Davide
Il giorno 19/mar/08, alle ore 17:40, Julien Jalon ha scritto:
I'd bet the firstNote object is not a "DBNNote" instance but an
NSString instance.
On Wed, Mar 19, 2008 at 5:33 PM, Davide Benini
<email@hidden> wrote:
Hello folks.
I receive an exception message and my application exits whenever I try
to access properties or methods of an instance of DBNNote, a custo
made class.
Here is the code:
DBNNote *firstNote= [[tune body] objectAtIndex:0];
NSLog(@"%@", firstNote);
NSLog(@"%@", [firstNote accident]);
And this is the exception:
2008-03-19 17:19:30.957 cocoabc[10832:10b] Note: A flat Octave: 6
Duration: 3.000000
2008-03-19 17:19:30.957 cocoabc[10832:10b] *** -[NSCFString accident]:
unrecognized selector sent to instance 0x33b040
2008-03-19 17:19:30.958 cocoabc[10832:10b] An uncaught exception was
raised
2008-03-19 17:19:30.958 cocoabc[10832:10b] *** -[NSCFString accident]:
unrecognized selector sent to instance 0x33b040
2008-03-19 17:19:30.959 cocoabc[10832:10b] *** Terminating app due to
uncaught exception 'NSInvalidArgumentException', reason: '*** -
[NSCFString accident]: unrecognized selector sent to instance
0x33b040'
2008-03-19 17:19:30.959 cocoabc[10832:10b] Stack: (
2505978443,
2451210491,
2506007626,
2506000972,
2506001170,
13259,
8495,
2506037845,
2490420930,
2490380524,
2490378829,
2490377872,
2490377678,
2490376830,
8372,
8298
)
The Debugger has exited due to signal 5 (SIGTRAP).The Debugger has
exited due to signal 5 (SIGTRAP).
As you see the first line of the exception message correctly logs
[firstNote description].
The second NSLog should print "flat".
So it appears the object is correctly instantiated, yet I cannot
access its methods. I have tried to call both methods and properties
accessors, but no call works so far. I have a feeling I am making a
very basic mistake, but I can't tell which one.
Any suggestion?
Davide
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden