Setting company checkbox programatically in an AddressBook
Setting company checkbox programatically in an AddressBook
- Subject: Setting company checkbox programatically in an AddressBook
- From: development2 <email@hidden>
- Date: Tue, 9 Dec 2008 14:18:17 -0700
I am having a problem setting the Checkbox to show the address book
item is for a company. It seems to crash settig the value. What am I
doing wrong?
// we need to create this address item
addressItem = [[[ABPerson alloc] init] autorelease];
[addressItem setValue:NSLocalizedString(@"ADDRESS_ITEM_NAME", nil)
forProperty:kABOrganizationProperty];
ABMutableMultiValue* emailList = [[ABMutableMultiValue alloc] init];
[emailList insertValue:NSLocalizedString(@"OTHER_EMAIL_VALUE", nil)
withLabel:NSLocalizedString(@"OTHER_EMAIL_NAME", nil)
atIndex:0];
[addressItem setValue:emailList
forProperty:kABEmailProperty];
int personFlags = [[addressItem valueForProperty:kABPersonFlags]
intValue];
personFlags = (kABShowAsMask && kABShowAsCompany);
[addressItem removeValueForProperty:kABPersonFlags];
[addressItem setValue:[[NSNumber numberWithInt:personFlags]
stringValue] <<<<< Crashes HERE
forProperty:kABPersonFlags];
[[ABAddressBook sharedAddressBook] addRecord:addressItem];
[[ABAddressBook sharedAddressBook] save];
If I take this line out everythign works fine!!!! I don't get it this
should be so simple...
Thanks for any help in advance.
_______________________________________________
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