Issues with Notifications in MacRuby
Hello, I'm playing with notification in MacRuby but I don't know the behavior of the same thing in Objc is a little diferent. I believe the problem could be something related to Macruby's XCode template that don't do something that the normal cocoa do. The app is really simple and I just created a new MacRuby app: 1º added the AddressBook framework in the target 2º in rb_main.rb I added: framework 'AddressBook' 3º in Interface build I dropped an ABPeoplePicker 4º created an new class called PeoplePickerViewController 5º made an NSObject in IB and set the class to my new controller 6º made an outlet to the ABPeoplePicker 7º add awakeFromNib and register an observer for notification. Everything goes and compile but the selector registered in notification is not called when user interact with ABPeoplePicker. I followed the same steps in pure Objc app and everything worked very well. Here is my Ruby code: https://gist.github.com/782006 (and the app http://cl.ly/42CZ) Here is my Objc code: https://gist.github.com/782007 Probably is something that I don't know how to do in MacRuby and is different from Objc. Someone could help? Thanks a lot.
On Jan 16, 2011, at 6:28 PM, Daniel Lopes wrote:
Everything goes and compile but the selector registered in notification is not called when user interact with ABPeoplePicker.
Are you sure? I'm asking because building and running the code in FaceFinder.zip gives me this in the console: [Switching to process 3977] Running… blabla blabla Also, I used notifications before and did not have any problems. What's your version of MacRuby? Here's mine: macruby -v MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64] --- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
Daniel, it looks to me that your object might get GC'd. Try using an instance variable instead let us know. - Matt Sent from my iPhone On Jan 16, 2011, at 14:18, Joel Reymont <joelr1@gmail.com> wrote:
On Jan 16, 2011, at 6:28 PM, Daniel Lopes wrote:
Everything goes and compile but the selector registered in notification is not called when user interact with ABPeoplePicker.
Are you sure?
I'm asking because building and running the code in FaceFinder.zip gives me this in the console:
[Switching to process 3977] Running… blabla blabla
Also, I used notifications before and did not have any problems.
What's your version of MacRuby? Here's mine:
macruby -v MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64]
--- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (3)
-
Daniel Lopes
-
Joel Reymont
-
Matt Aimonetti