addressbook

Get image of a person from iPhone address book

与世无争的帅哥 提交于 2019-11-30 17:16:34
How do you get a person's image from an iPhone address book? You can do it like this.... NSData *imgData = (NSData *)ABPersonCopyImageData(person); UIImage *img = [UIImage imageWithData:imgData]; where person is of type ABRecordRef . Now, as CFData and NSData are toll-free bridged, you can simply type cast CFData to NSData and get the image Hope this helps. ChangUZ (NSData*)ABPersonCopyImageDataWithFormat([targetPeople objectAtIndex:index], kABPersonImageFormatThumbnail) This is faster since it returns a thumbnail. Slightly refreshed code: UIImage *image = nil; @try { CFDataRef cfImage =

How to acess contacts of iPhone in IOS 6

无人久伴 提交于 2019-11-30 16:35:06
I want to show contacts and details of contacts in my application.List of contacts and after selecting any contact details of that contact will show on next page using addressbook. I am working on IOS 6. Thanks in advance. Following code for retrieving contact details. - (void)viewDidLoad { [super viewDidLoad]; contactList=[[NSMutableArray alloc] init]; ABAddressBookRef m_addressbook = ABAddressBookCreate(); if (!m_addressbook) { NSLog(@"opening address book"); } CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(m_addressbook); CFIndex nPeople = ABAddressBookGetPersonCount(m_addressbook

How to get street address from ABPeoplePickerNavigationController

拈花ヽ惹草 提交于 2019-11-30 15:23:31
I need a contact's street address. I know how to get the single value properties, but the street address is a multivalue property. Apple's documentation shows how to set it, but not retrieve it. Any help? PS: this does not work: ABRecordCopyValue(person, kABPersonAddressStreetKey); I just figured it out: ABMultiValueRef st = ABRecordCopyValue(person, kABPersonAddressProperty); if (ABMultiValueGetCount(st) > 0) { CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(st, 0); self.street.text = CFDictionaryGetValue(dict, kABPersonAddressStreetKey); } Swift version : if let addresses :

iphone addressbook - getting null item in ABAddressBookGetPersonWithRecordID

别说谁变了你拦得住时间么 提交于 2019-11-30 13:43:00
I'm really struggling with ABAddressBookGetPersonWithRecordID at the moment. I am saving an ID, and then trying to call it back up again. Currently im doing something simple to test the linking, but its not working. First, I can read objects from my iphone simulator address book using: -(BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { NSString *contactName; NSString *contactCompany; NSString *contactFirst; NSString *contactLast; contactFirst = [(NSString *)ABRecordCopyValue(person,

how can I Add a ABRecordRef to a NSMutableArray in iPhone?

醉酒当歌 提交于 2019-11-30 12:53:54
I want to create an array of ABRecordRef(s) to store contacts which have a valid birthday field. NSMutableArray* bContacts = [[NSMutableArray alloc] init]; ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); for( int i = 0 ; i < nPeople ; i++ ) { ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i ); NSDate* birthdayDate = (NSDate*) ABRecordCopyValue(ref, kABPersonBirthdayProperty); if (birthdayDate != nil){ [bContacts addObject:ref]; } } The compiler shows

Objective C Adding a Contact to a specific Group in the iPhone

…衆ロ難τιáo~ 提交于 2019-11-30 10:09:40
I am making an App that stores contacts in the address book , I am using Xcode 4.2 I know how to add a contact in the address book , let s say I have a group called "A" in the Contact list and I want to Add this contact to this group , how to do that ? here is the Code I am using : ABAddressBookRef *iPhoneAddressBook = ABAddressBookCreate(); ABRecordRef contact = ABPersonCreate(); //add infos ABRecordSetValue(contact, kABPersonFirstNameProperty,(__bridge_retained CFStringRef)firstName, nil); ABRecordSetValue(contact, kABPersonLastNameProperty,(__bridge_retained CFStringRef)lastName, nil);

Sort NSArray of NSStrings like Addressbook on iphone sort

给你一囗甜甜゛ 提交于 2019-11-30 09:07:44
I have an array of strings (names) and i would like to sort them like how the address book on the iphone sorts them eg: éli -> under E eg: àli -> under A eg: 4li -> under # any suggestions? You need to perform a diacritic insensitive comparison against the strings. NSString has a compare:options: method with an option of NSDiacriticInsensitiveSearch . NSArray *array = [NSArray arrayWithObjects:@"éli", @"bob", @"earl", @"allen", @"àli", @"aaron", nil]; NSArray *sorted = [array sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { return [(NSString*)obj1 compare:obj2 options

localising postal / physical address display from database fields

こ雲淡風輕ζ 提交于 2019-11-30 05:03:36
Can anyone point me to a list of international postal / residential / delivery address format templates that use some kind of parseable standard vocabulary for address parts? The ideal list contains a country code then a format using replaceable tokens so I can substitute database address fields into a template to produce something printable in the local format. for example NZ | [first_name] [family_name]\n[company_name]\n[street_address]\n[city] [post_code]\n[country] AU | [first_name] [family_name]\n[company_name]\n[street_address]\n[city]\n[state] [post_code]\n[country] US | etc UK | etc

How to correctly use ABPersonViewController with ABPeoplePickerNavigationController to view Contact information?

折月煮酒 提交于 2019-11-30 00:14:47
Update 9/2/10: This code no longer works as of the iOS 4 update--it fails with an internal assertion. There is now a great Address Book API example available in the iPhone SDK Reference Library called "QuickContacts." The example code is available here; it will help you solve this problem: http://developer.apple.com/iphone/library/samplecode/QuickContacts/Introduction/Intro.html I'm attempting to add a feature to my app that allows the user to select a contact from an ABPeoplePickerNavigationController , which then displays an ABPersonViewController corresponding to the contact they picked. At

AddressBook synchronization in iOS

好久不见. 提交于 2019-11-30 00:06:54
Is there any way in iOS to get notification about address book changes since the last time applications was opened. The application stores address book in internal database and I don't want to perform full sync each time it activated. Thanks in advance. Small addition to clarify the question: I use ABAddressBookRegisterExternalChangeCallback to observe changes when application suspended to background, but from what I know, this method can't work if application was closed completely and reopened(for example: after phone restart or closed from task list). Maybe you're looking for this: