[SOLVED] Re: AddressBook & phone multivalue
[SOLVED] Re: AddressBook & phone multivalue
- Subject: [SOLVED] Re: AddressBook & phone multivalue
- From: "T G" <email@hidden>
- Date: Sat, 09 Nov 2002 22:32:20 +0000
Hi,
Thank you to everyone who replied. It turns out that this was a retain issue
-- I was passing the ABPerson into another method and I should have done a
retain before passing. D'oh!! :)
It might be of interest to know, by the way, that the phone multivalue was
the only one auto-released during the passing into the other method. The
addresses and other fields remained intact. It just struck me as odd; I
would have expected all or none of the multivalue fields to come through.
Terence
From: Sheehan Olver <email@hidden>
To: email@hidden
CC: email@hidden
Subject: Re: AddressBook & phone multivalue
Date: Sat, 9 Nov 2002 15:03:57 -0600
I have the following method that seems to work fine:
-(ABMultiValue *)phoneNumbers
{
return [self valueForProperty:kABPhoneProperty];
}
Note the use of ABMultiValue instead of ABMutableMultiValue. I don't know
how Objective-C handles casting an object to the wrong type, perhaps it
causes it to be nil? If you want to change it, do the following:
ABMutableMultiValue *updated;
updated = [[self phoneNumbers] mutableCopy];
... do changes ...
[self setValue:updated forProperty:kABPhoneProperty];
[[ABAddressBook sharedAddressBook] save];
Hopefully the colors didn't mess up the code, I've had some problems with
ProjectBuilder colors when copying into email.
On Saturday, November 9, 2002, at 12:00 AM,
email@hidden wrote:
Message: 3
From: "T G" <email@hidden>
To: email@hidden
Subject: AddressBook & phone multivalue
Date: Fri, 08 Nov 2002 21:46:27 +0000
Hi all,
I'm having trouble with phone numbers & the AddressBook. Specifically,
when
I try to retreive the phone numbers for a given person, I get no data,
regardless of the fact that the contact in question definitely has at
least
one phone number.
Here's how I'm doing it... (where person is of type ABPerson *)
ABMutableMultiValue *phone;
//...
phone = [person valueForProperty:kABPhoneProperty];
//...
phone is always nil. :(
Has anyone else encountered this? Or is it just something really basic
that
I've managed to overlook?
Thanks,
Terence
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.