• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AddressBook & phone multivalue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AddressBook & phone multivalue


  • Subject: Re: AddressBook & phone multivalue
  • From: Sheehan Olver <email@hidden>
  • 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
_______________________________________________
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.

  • Prev by Date: .dmg displaying license agreement when mounted (solved)
  • Next by Date: Re: GCC not doing the correct thing?
  • Previous by thread: Re: AddressBook & phone multivalue
  • Next by thread: Sample Code for "weak-linking" to a framework using NSAddressOfSymbol
  • Index(es):
    • Date
    • Thread