Fail to access kABFirstNameProperty
Hello, I'm playing with AddressBook framework but I can't figure how access the predefined constants. For example, in my ViewControler I do like below but XCode can't find kABFirstNamePropery. I already added framework 'AddressBook' in my rb_main.rb: def awakeFromNib notificationCenter = NSNotificationCenter.defaultCenter notificationCenter.addObserver(self, selector: "recordChanged:", name: ABPeoplePickerNameSelectionDidChangeNotification, object:peoplePicker) end def recordChanged(notification) people = peoplePicker.selectedRecords person = people.first puts kABFirstNameProperty end Anyone can help me with this issue? Thanks in advance ;)
Constants in Ruby start by an uppercase, rename kABFirstNamePropery => KABFirstNamePropery Also I have an address book example in my book you can see freely online. - Matt Sent from my iPhone On Jan 15, 2011, at 19:24, Daniel Lopes <danielvlopes@gmail.com> wrote:
Hello,
I'm playing with AddressBook framework but I can't figure how access the predefined constants.
For example, in my ViewControler I do like below but XCode can't find kABFirstNamePropery. I already added framework 'AddressBook' in my rb_main.rb:
def awakeFromNib notificationCenter = NSNotificationCenter.defaultCenter notificationCenter.addObserver(self, selector: "recordChanged:", name: ABPeoplePickerNameSelectionDidChangeNotification, object:peoplePicker) end
def recordChanged(notification) people = peoplePicker.selectedRecords person = people.first puts kABFirstNameProperty end
Anyone can help me with this issue?
Thanks in advance ;) _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Actually I realized I didn't put the full Address Book example online yet, but this section shows how to use method missing to write a nicer wrapper for the AddressBook framework: http://ofps.oreilly.com/titles/9781449380373/ch03.html#_method_missing I hope it helps, - Matt On Sat, Jan 15, 2011 at 7:26 PM, Matt Aimonetti <mattaimonetti@gmail.com>wrote:
Constants in Ruby start by an uppercase, rename kABFirstNamePropery => KABFirstNamePropery
Also I have an address book example in my book you can see freely online.
- Matt
Sent from my iPhone
On Jan 15, 2011, at 19:24, Daniel Lopes <danielvlopes@gmail.com> wrote:
Hello,
I'm playing with AddressBook framework but I can't figure how access the predefined constants.
For example, in my ViewControler I do like below but XCode can't find kABFirstNamePropery. I already added framework 'AddressBook' in my rb_main.rb:
def awakeFromNib notificationCenter = NSNotificationCenter.defaultCenter notificationCenter.addObserver(self, selector: "recordChanged:", name: ABPeoplePickerNameSelectionDidChangeNotification, object:peoplePicker) end
def recordChanged(notification) people = peoplePicker.selectedRecords person = people.first puts kABFirstNameProperty end
Anyone can help me with this issue?
Thanks in advance ;)
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Thank Matt, I thought there was any compatible layer or trick to make objc constants work as ruby constants. Thanks a lot again (and thanks for the book too). On 16/01/2011, at 01:33, Matt Aimonetti wrote:
Actually I realized I didn't put the full Address Book example online yet, but this section shows how to use method missing to write a nicer wrapper for the AddressBook framework:
http://ofps.oreilly.com/titles/9781449380373/ch03.html#_method_missing
I hope it helps,
- Matt
On Sat, Jan 15, 2011 at 7:26 PM, Matt Aimonetti <mattaimonetti@gmail.com> wrote: Constants in Ruby start by an uppercase, rename kABFirstNamePropery => KABFirstNamePropery
Also I have an address book example in my book you can see freely online.
- Matt
Sent from my iPhone
On Jan 15, 2011, at 19:24, Daniel Lopes <danielvlopes@gmail.com> wrote:
Hello,
I'm playing with AddressBook framework but I can't figure how access the predefined constants.
For example, in my ViewControler I do like below but XCode can't find kABFirstNamePropery. I already added framework 'AddressBook' in my rb_main.rb:
def awakeFromNib notificationCenter = NSNotificationCenter.defaultCenter notificationCenter.addObserver(self, selector: "recordChanged:", name: ABPeoplePickerNameSelectionDidChangeNotification, object:peoplePicker) end
def recordChanged(notification) people = peoplePicker.selectedRecords person = people.first puts kABFirstNameProperty end
Anyone can help me with this issue?
Thanks in advance ;) _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (2)
-
Daniel Lopes
-
Matt Aimonetti