Code example for ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering?
Does anyone have a code example of how to properly set up the parameters and use the ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering() API to get sorted subsets of the iPhone Contact list?
- Cannot create outlet connections to subviews in Interface Builder (Xcode 5)
- how to find size of my iphone app programatically?
- AVPlayer HLS live stream level meter (Display FFT Data)
- Invalid Swift Support. … “doesn’t have the correct file type for this location” on App validation
- SDWebImage process images before caching
- Perform Segue programmatically and pass parameters to the destination view
2 Solutions Collect From Internet About “Code example for ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering?”
The following should work:
ABAddressBookRef aB = ABAddressBookCreate(); ABRecordRef source = ABAddressBookCopyDefaultSource(aB); // or get the source with ABPersonCopySource(somePersonsABRecordRef); NSArray *arr = (NSArray *)ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(aB, source, kABPersonSortByLastName); // you can also use kABPersonSortByFirstName instead of kABPersonSortByLastName
This worked for me:
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, error); ABRecordRef source = ABAddressBookCopyDefaultSource(addressBook); NSArray *allPeople = (__bridge NSArray *)ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(addressBook, source, kABPersonSortByFirstName);
- The advertisingIdentifier and identifierForVendor return “00000000-0000-0000-0000-000000000000”
- How to use UnsafeMutablePointer in Swift 3?
- Custom UITableViewCell with Progress Bar download update
- How to use one IBAction for multiple buttons in Swift?
- swift 3 – search result also with diacritics
- indexPathForSelectedRow returning nil
- Ignoring NSURLErrorDomain error -999 does not work in UIWebView
- How to Make the scroll of a TableView inside ScrollView behave naturally
- Correctly returning UIView in viewForHeaderInSection iOS 8 swift
- Are “Complex Numbers” already defined in Objective-C?
- How to make a UIView with optional rounded corners and border?
- Activity indicator with custom image
- Is it possible to login in twitter within an iOS app and not use the twitter account that is stored in the settings of the device?
- Switch statement for imported NS_OPTIONS (RawOptionSetType) in Swift?
- NSDictionary to json string to json object using SwiftyJSON