Re: kABHomeLabel … and companions
Re: kABHomeLabel … and companions
- Subject: Re: kABHomeLabel … and companions
- From: Richard Heard <email@hidden>
- Date: Thu, 13 Sep 2012 22:44:38 -0700
On iOS you would be looking for ABPersonCopyLocalizedPropertyName() on the Mac you would be looking for ABCopyLocalizedPropertyOrLabel().
-Richard
On 13/09/2012, at 9:33:06 PM, Erik Stainsby <email@hidden> wrote:
> I understand that ABAddressBook methods are concerned with ABPerson and ABGroup entities, subclasses of ABRecord.
> However, the ABMultiValue collections are less intuitive. Among these are stored the (potentially) multiple instances of addresses, phone numbers and email addresses. For each instance of user supplied data, a multiValue object can store - in properties keyed with kABXxxx keys - arbitrary labels: home, work, iPhone, mobile, etc. The documentation leaves much to be desired, but in particular, I cannot glean how to retrieve a user-supplied string from a given multiValue object.
>
> Some code:
>
> Given some address, stored in an ABMultiValue object, such that:
>
> - (void) unwrapMV:(ABMultiValue*)mv atIndex:(int)index {
>
> NSString * _uuid = [mv identifierAtIndex:index];
> NSString * _label = [mv labelForIdentifier:[mv identifierAtIndex:index]];
> NSDictionary * _dict = [mv valueAtIndex:index];
> // am I the identified primary entry?
> BOOL _primary = ([mv primaryIdentifier] == self.uuid)? YES: NO;
>
> NSLog( @"%@", _label) ;
> }
>
> produces _$!<Home>!$_,
> or one of the other variants of the actual value of the key, not the value it refers to.
>
> Clearly I am failing to understand where these strings are being stored.
>
> Erik Stainsby
> email@hidden
>
>
> On 2012-09-13, at 9:04 PM, Jerry Krinock <email@hidden> wrote:
>
>>
>> On 2012 Sep 13, at 19:45, Erik Stainsby <email@hidden> wrote:
>>
>>> So the AddressBook framework's xxxLabel keys render out as strings encoded like so: _$!<Home>!$_, _$!<Work>!$_, _$!<Mobile>!$_ Is there framework method I am meant to use with the property keys kABHomeLabel, kABWorkLabel, etc, to render a legible text outcome
>>
>> Maybe you're looking for -[ABRecord valueForProperty:]. Note that ABAddressBook methods typically return ABPerson objects, and ABPerson inherits from ABRecord.
>>
>> If that doesn't explain it, post some code.
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden