ABMutableMultiValue error
ABMutableMultiValue error
- Subject: ABMutableMultiValue error
- From: Steven Crosley <email@hidden>
- Date: Wed, 23 Jan 2008 08:44:38 -0600
Hi,
I'm getting an error when trying to modify a textfield that is
attempting to change the value of the main phone number label in
address book:
ABMultiValueCoreDataWrapper removeValueAndLabelAtIndex:]: unrecognized
selector sent to instance
I get this error when I use either the removeValueAndLabelAtIndex: or
the replaceValueAtIndex: withValue: methods. Here's the code that I'm
using:
- (void) setMainPhoneNumber: (NSString*) newMainPhoneNumber
{
ABAddressBook *book = [ABAddressBook sharedAddressBook];
ABPerson *person;
ABMutableMultiValue *phone;
int i;
person = (ABPerson *)[book recordForUniqueId:[self uid]];
phone = [person valueForProperty:kABPhoneProperty];
for (i = 0; i < [phone count]; i++) {
if ([[phone labelAtIndex:i]
isEqualToString:kABPhoneMainLabel]) {
//[phone replaceValueAtIndex:i withValue:newMainPhoneNumber];
[phone removeValueAndLabelAtIndex:i];
}
}
[phone addValue:newMainPhoneNumber withLabel:kABPhoneMainLabel];
[person setValue: phone forProperty: kABPhoneProperty];
}
Any help would be appreciated. Thanks!
Steven
_______________________________________________
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