• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unable to access an instance properties and methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unable to access an instance properties and methods


  • Subject: Re: Unable to access an instance properties and methods
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 19 Mar 2008 11:23:24 -0700


On 19 Mar '08, at 10:00 AM, Davide Benini wrote:

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...


Here's some advice on how to debug stuff like this in the future...

The exception message is a good clue:
2008-03-19 17:19:30.957 cocoabc[10832:10b] *** -[NSCFString accident]: unrecognized selector sent to instance 0x33b040
This shows that the receiver of -accident was an NSCFString object.


The way I would track something like this down is, first, to set a symbolic breakpoint on objc_exception_throw (via Xcode's breakpoints window.) This is always a good thing to have. Then run the app in the debugger and it'll hit the breakpoint when the exception's raised.

Now select the topmost application stack frame — it'll be on the line that calls [firstNote accident]. Then you can enter "po firstNote" in the debugger console to see the object's description. But as you pointed out, it looks like the description of a DBNNote object even though it's a string, so you can't really tell from that. A more surefire test is to enter "po [firstNote class]", which will print "NSCFString" instead of "DBNNote". That's your smoking gun.

The "po" and "p" commands are incredibly useful debugging tools, since they let you make nearly any Objective-C call interactively on your running code. Gdb understands a surprisingly large subset of Objective- C syntax.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: Unable to access an instance properties and methods
      • From: Randall Meadows <email@hidden>
References: 
 >Unable to access an instance properties and methods (From: Davide Benini <email@hidden>)
 >Re: Unable to access an instance properties and methods (From: "Julien Jalon" <email@hidden>)
 >Re: Unable to access an instance properties and methods (From: Davide Benini <email@hidden>)

  • Prev by Date: Re: Intercepting retain/release of object
  • Next by Date: Re: Network communication with NSFileHandle & NSSocketPort
  • Previous by thread: Re: Unable to access an instance properties and methods
  • Next by thread: Re: Unable to access an instance properties and methods
  • Index(es):
    • Date
    • Thread