I’m trying to update my addressbook code for 64bit with the newer framework. Is there an equivalent of the owner property? Here is the very simple 32bit code:
[code]dim theAddressbook as new ABAddressBookMBS
if theAddressbook <> Nil then
dim theMe as ABPersonMBS = theAddressbook.owner '<–
if theMe = nil then Return
'do something with theMe
end if[/code]
I’ve had a look at the rather complex CNContactMBS but I can’t find anything about the owner property. I’m trying to find out the name and the email of the current user in case of a crash.
PS: The example “contacts display person” needs a nil check for contacts if nothing is found. “showValue c, c.CNContactImageDataAvailableKey” crashes here with an UnsupportedFormatException (latest plugins, Xojo 2017r1, the Captain).
Thanks, I’ll have a look!
This framework is more than slightly insane:
[code]dim theContactStore as new CNContactStoreMBS
dim theContact as CNContactMBS
dim theKeys() as CNKeyDescriptorMBS
dim theError as NSErrorMBS
theKeys.append CNContactVCardSerializationMBS.descriptorForRequiredKeys
theContact = theContactStore.unifiedMeContactWithKeysToFetch(theKeys, theError)
dim LastName as String = theContact.familyName
dim FirstName as String = theContact.givenName
dim EmailAddresses() as CNKeyDescriptorMBS = theContact.emailAddresses
if UBound(EmailAddresses) > -1 then
dim LabeledValue as CNLabeledValueMBS = CNLabeledValueMBS(EmailAddresses(0))
dim Value as String = LabeledValue.Value
end if[/code]
I have a huge address book synchronizer and every time I look at this monstrous mess, er, framework, in the thought of updating to it, I feel faint & slightly nauseous and go over to the couch and lie downwhat on earth were they thinking?
Dave