0

I am writing a small MacRuby script to grab some ABRecords from a search query, but I am unsure how to gain access to enums declared in a specific header file for the AddressBook framework.

I have this script and I am trying to have kABFirstNameProperty & kABEqual brought into the environment as constants. But when running the script the two constants cannot be found.

framework "Cocoa"
framework "AddressBook"

globalAddressBook = ABAddressBook.sharedAddressBook
criteriaElement = ABPerson.searchElementForProperty(kABFirstNameProperty, label:nil, key:nil, value:"Callum", comparison:kABEqual)
Callum Jones
  • 595
  • 4
  • 15

1 Answers1

4

In MacRuby (just as with Ruby) constants start with a capital letter by convention, so even though AddressBook defines this as kABFirstNameProperty, you need to spell it as KABFirstNameProperty. The same goes for the KABEqual constant in your example, of course.

jkh
  • 3,246
  • 16
  • 13