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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to