• 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
Trying to get data from the AB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to get data from the AB


  • Subject: Trying to get data from the AB
  • From: Development <email@hidden>
  • Date: Tue, 6 Apr 2010 11:48:25 -0700

	I am using the following:

	[settings setObject:(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty) forKey:@"First Name"];
	[settings setObject:(NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty) forKey:@"Last Name"];
	//
	ABMutableMultiValueRef multiValue = ABRecordCopyValue(person, kABPersonAddressProperty);

	**Crashes here*** CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(multiValue, 0);

	CFStringRef street = CFDictionaryGetValue(dict, kABPersonAddressStreetKey);
	CFStringRef abcity = CFDictionaryGetValue(dict, kABPersonAddressCityKey);
	CFStringRef abstate = CFDictionaryGetValue(dict, kABPersonAddressStateKey);
	CFStringRef abzip = CFDictionaryGetValue(dict, kABPersonAddressZIPKey);
	NSLog(@"%@",(NSDictionary*)dict);
	CFRelease(dict);
	[settings setObject:(NSString *)street forKey:@"City"];
	[settings setObject:(NSString *)abstate forKey:@"State"];
	[settings setObject:(NSString *)abzip forKey:@"Zip"];
	[settings setObject:(NSString *)street forKey:@"Address"];
	//
	[settings setObject:(NSString *)ABRecordCopyValue(person, kABPersonPhoneMainLabel) forKey:@"Phone"];
	[settings setObject:(NSString *)ABRecordCopyValue(person, kABPersonPhoneWorkFAXLabel) forKey:@"Fax"];
	[settings setObject:(NSString *)ABRecordCopyValue(person, kABPersonURLProperty) forKey:@"URL"];
	[settings setObject:(NSString *)ABRecordCopyValue(person, kABPersonEmailProperty) forKey:@"Email"];
	[settings setObject:(NSString *)ABRecordCopyValue(person, kABPersonOrganizationProperty) forKey:@"Business"];

To get information from the address book and insert it in to the preferences. But the Application is crashing when I attempt to copy the data to the CFDictionary.

Are there any examples of doing this I could look at?_______________________________________________

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: Trying to get data from the AB
      • From: Jens Alfke <email@hidden>
  • Prev by Date: NSPrintSavePath not working correctly?
  • Next by Date: Re: [iPhone]Is it possible for apps to use the file sharing directory?
  • Previous by thread: Re: NSPrintInfo, setting filename for print to PDF?
  • Next by thread: Re: Trying to get data from the AB
  • Index(es):
    • Date
    • Thread