• 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
Setting company checkbox programatically in an AddressBook
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Setting company checkbox programatically in an AddressBook
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Multithreading and Mach ports
  • Next by Date: Creating a window when pressing a button
  • Previous by thread: Re: Multithreading and Mach ports
  • Next by thread: Re: Setting company checkbox programatically in an AddressBook
  • Index(es):
    • Date
    • Thread