From: Rod S. <rsc...@xm...> - 2007-11-03 19:56:45
|
The OSX module is required. I have imported the BackpackReminder class. 3) The CSS_class method does not exist on the ObjC side. One other piece of information is that BackpackReminder descends from NSManagedObject. Could CoreData be messing things up? The inheritance hierarchy is: NSManagedObject -> BackpackManagedObject -> BackpackReminder Rod On Nov 3, 2007, at 1:07 PM, Laurent Sansonetti wrote: > On Nov 3, 2007 1:18 PM, Rod Schmidt <rsc...@xm...> wrote: >> I have the following Ruby code in my RubyCocoa app (in which I have >> mostly Objective-C with some Ruby). >> >> class BackpackReminder >> def CSS_class >> date = NSDateToRubyDateTime(self.date) >> now = DateTime.now >> days_from_now = date.jd - now.jd >> if days_from_now <= 30 then >> "day#{days_from_now}" >> else >> "month#{self.months_from_now}" >> end >> end >> end >> >> BackpackReminder is an Objective-C class, so I am reopening this >> class >> and adding the CSS_Class method. This worked fine in Tiger. When I >> run >> the app I get the following: >> >> 11/3/07 12:55:52 PM PackRat[1109] PageGenerator#generateHTML: >> OSX::OCMessageSendException: Can't get Objective-C method signature >> for selector 'CSS:class' of receiver >> #<OSX::BackpackReminder_BackpackReminder_:0x265a5c >> class='BackpackReminder' id=0x6115b0> >> 11/3/07 12:55:52 PM PackRat[1109] Exception raised during posting of >> notification. Ignored. exception: 'Can't get Objective-C method >> signature for selector 'CSS:class' of receiver >> #<OSX::BackpackReminder_BackpackReminder_:0x265a5c >> class='BackpackReminder' id=0x6115b0>' invoked observer method: >> '*** - >> [PackRatAppDelegate tableViewSelectionDidChange:]' observer: >> 0x6f3dd0 notification name: >> 'NSTableViewSelectionDidChangeNotification' >> >> If I rename the method and remove the underscore and rename it >> something like CSSClass, I get the same message (with the method name >> changed of course). Has something changed in the Leopard version of >> RubyCocoa that prevents you from reopening classes and adding >> methods? >> > > No, nothing changed in this logic. However, most of the code that adds > or overrides methods was ported to the ObjC 2.0 API, and maybe there > is a regression in that area. > > I am nevertheless unable to reproduce this in a quick test. > > A few questions: > > 1/ Is the OSX module required? > > 2/ Does it also happen if you explicitly import the BackpackReminder > class before doing the override? You can add ''OSX.ns_import : > BackpackReminder'' at the beginning of the file to try that. > > 3/ Does the CSS_class method exists in the ObjC side? > > Thanks, > Laurent > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a > browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk |