• 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: log command problem?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: log command problem?


  • Subject: Re: log command problem?
  • From: Dave <email@hidden>
  • Date: Fri, 14 Jan 2011 06:56:19 -0600

I've finally found the cause of mysterious program errors vexing the development of a rather large ASOC project. Typically the errors were syslog lines of:

  -[CalendarBug currentCalendar]: unrecognized selector sent to object <CalendarBug @0x200668be0: OSAID(7)>

where the selector was a valid handler in the same script and appeared unrelated to the then currently executing handler. At that point any further code modifications, even trivial ones, could make the program EXC_BAD_ACCESS fault with no log messages issued, or fault in a later executed portion of the application, or start running correctly again. When a problem occurred it was totally reproducible until the source code was next modified. Then it would either stay the same, go away or get worse.

The problem was my incorrect use of a saved reference as follows:
______
property NSCalendar : class "NSCalendar"
property currentCalendar : missing value

script CalendarBug

on aHandler()
set currentCalendar to NSCalendar's currentCalendar()
...
set GMTAdjustedDate to currentCalendar()'s dateByAddingComponents_toDate_options_(theComponents, theCalendarDate, 0)
--  SHOULD BE:  currentCalendar's
______

Perhaps there is a reason why the ASOC runtime needs to try invoking the currentCalendar method on the script class. I would have found this bug right away if the unrecognized selector error had referenced the NSCalendar instance. That logged message is not correct given that the selector is a valid one for a handler in the reported object (my script.)

Another runtime malfunction might be the fact that no error log messages make it out if the program bombs (EXC_BAD_ACCESS.) Perhaps if a program faults too quickly after a log message is emitted (by the runtime in my case) some messages never make it out?

Happy Coding!
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: log command problem? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Overridden NSObject class cannot get instance properties
  • Next by Date: X-Code not formatting my code
  • Previous by thread: Re: log command problem?
  • Next by thread: textShouldEndEditing or textDidEndEditing
  • Index(es):
    • Date
    • Thread