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: "Julien Jalon" <email@hidden>
- Date: Wed, 19 Mar 2008 17:40:08 +0100
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