Is the example: AddressBook suposed to work, or has been deprecated?
On my Mac the Address Book is called Contacts.
On latest MacOS 10.14.6 and latest Xojo 19, 1.1.don't seem to work.
@Enric H On latest MacOS 10.14.6 and latest Xojo 19, 1.1.don't seem to work.
@Jean-YvesPochez it works for me on 10.11.6 and latest Xojo.
In macOS 10.11, Apple introduced a new mechanism for accessing the "Address Book" / "Contacts". I am not at my work 'puter, but I suspect that if you look through Feedback you'll find requests to update to the newer API.
MacOS 10.14.6 and Xojo 2019r1.1
In my apps I succesfully retrieve data with this snippet:
Dim book as AddressBook = System.AddressBook Dim Contacts() as AddressBookContact = book.Contacts Dim groups() as AddressBookGroup dim theData as addressBookData if UBound(Contacts) >= 0 then dim a, aa, z, mSplit(), temp as string For i as integer = 0 to Ubound(Contacts) a = "" a = contacts(i).firstname aa = contacts(i).lastName if a = "" and aa = "" then//avoid groups else if a <> "" then a = a + " " if aa <> "" then a = a + aa if a <> "" then a = trim(a) + " <" z = ">" end if thedata = contacts(i).emailaddresses //etcetera
I used to use an applescript to let users import only contacts they wished. It was very handy, but a couple of years ago I disposed of it because I foresaw that sooner or later MAS might force me to remove it. Thanks, Apple, for helping us cripple our apps.