Re: Strange result from Address Book
Re: Strange result from Address Book
- Subject: Re: Strange result from Address Book
- From: Graham Cox <email@hidden>
- Date: Tue, 4 Aug 2009 13:51:00 +1000
On 04/08/2009, at 1:17 PM, Graham Cox wrote:
I'm using the following code from Uli's UKCrashReporter:
ABMultiValue* emailAddresses = [[[ABAddressBook sharedAddressBook]
me] valueForProperty: kABEmailProperty];
NSString* emailAddr =
NSLocalizedStringFromTable
(@"MISSING_EMAIL_ADDRESS",@"UKCrashReporter",@"");
if( emailAddresses )
{
NSString* defaultKey = [emailAddresses primaryIdentifier];
if( defaultKey )
{
unsigned int defaultIndex = [emailAddresses indexForIdentifier:
defaultKey];
if( defaultIndex != NSNotFound )
emailAddr = [emailAddresses valueAtIndex: defaultIndex];
}
}
<defaultKey> comes back as a reasonable looking UUID string.
<defaultIndex> comes back as 0.
<emailAddr> comes back as @"0x17C726C0" which is clearly bogus. I've
checked my own entry in the Address Book app and it's fine. The
initial "missing" email address is loaded correctly, but gets
overwritten by the hex string.
Anyone any idea what's going on?
More info:
If I do 'po emailAdresses' I get:
{
* home 0x17C726C0
home 0x172A3D70
}
and if I do 'po 0x17C726C0' I get:
<ABCDEmailAddress: 0x17C726C0 > (entity: ABCDEmailAddress; id:
0x18e2e1a0 <x-coredata://5886BF42-F5AE-4627-A66F-1A562205BD07/ABCDEmailAddress/p13
> ; data: {
address = 0x17C726C0;
addressNormalized = "email@hidden";
distributionListConfigs = "<relationship fault: 0x19a801d0
'distributionListConfigs'>";
isPrimary = 1;
isPrivate = nil;
label = "_$!<Home>!$_";
orderingIndex = 0;
owner = 0x164e6c40 <x-coredata://5886BF42-F5AE-4627-A66F-1A562205BD07/ABCDContact/p15
>;
uniqueId = "9D4F1D76-4859-11D7-A1BB-00039353556E";
})
(I've obscured the email address as an anti-spam measure).
The ABPropertyType comes back as 257 which is kABMultiValueMask |
kABStringProperty, but the actual value looks like a Core Data entity
of some sort, not a string.
Is this a bug in ABMultiValue's -valueAtIndex: method? Again, just
what is going on?
--Graham
_______________________________________________
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