[MacRuby-devel] NSNotificationCenter observers, selectors and notifications

Laurent Sansonetti lsansonetti at apple.com
Sat Apr 24 13:41:07 PDT 2010


Also, note that you can use a symbol too, which is more efficient (they are only created once):

> NSNotificationCenter.defaultCenter.addObserver(self, selector: :"track_finished:" name:QTMovieDidEndNotification, object:nil)

Laurent

On Apr 24, 2010, at 1:32 PM, Thibault Martin-Lagardette wrote:

> I concur.
> 
> The problem is that you call:
> NSNotificationCenter.defaultCenter.addObserver(self, selector: :track_finished, name:QTMovieDidEndNotification, object:nil)
> 
> That means you tell the notification center to call "track_finished", not "track_finished:" :-)
> 
> -- 
> Thibault Martin-Lagardette
> 
> 
> 
> On Apr 24, 2010, at 03:41, Jakub Suder wrote:
> 
>> Hi,
>> 
>> In ObjC, a method 'foo' that has one argument is referenced as 'foo:'
>> in such situations (with colon), not 'foo'. Try passing a string
>> "track_finished_with_notifier:" to the notification center.
>> 
>> Jakub Suder
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100424/d89fa0df/attachment.html>


More information about the MacRuby-devel mailing list