Swift – Checking unmanaged address book single value property for nil

If I want the values associated with various properties, I use the following syntax: let first = ABRecordCopyValue(person, kABPersonFirstNameProperty)?.takeRetainedValue() as? String let last = ABRecordCopyValue(person, kABPersonLastNameProperty)?.takeRetainedValue() as? String Or you can use optional binding: if let first = ABRecordCopyValue(person, kABPersonFirstNameProperty)?.takeRetainedValue() as? String { // use `first` here } if let last = ABRecordCopyValue(person, kABPersonLastNameProperty)?.takeRetainedValue() as? … Read more

Detect what was changed from ABAddressBookRegisterExternalChangeCallback

I found the solution to find what was changed in the addressbook. I am not sure if its a precise one, But some how that works. Create a Callback Notification for Addressbook:- ABAddressBookRef ntificationaddressbook = ABAddressBookCreate(); ABAddressBookRegisterExternalChangeCallback(ntificationaddressbook, MyAddressBookExternalChangeCallback, self); Than Add the following code when notification Occurs:- void MyAddressBookExternalChangeCallback (ABAddressBookRef ntificationaddressbook,CFDictionaryRef info,void *context) { NSTimeInterval … Read more

Obtaining Specific ABSource from ABAddressBook in iOS 4+

iOS 4+ provides new API that allows one to select a specific ABSource from the ABAddressBook. This may be useful as some operations, e.g. creating an ABGroup, are not supported in some sources (i.e. Exchange). “Not all source types support groups, more conspicuously, Exchange does not know anything about groups.” – http://flavors.me/volonbolon#1a5/tumblr Attached are functions … Read more

Toggling Privacy settings will kill the app

the OS sends a SIGKILL which is not a crash – Apple session on privacy in iOS6 says: If permissions changes, app is quit. Background task expiration handler is called, if registered iOS then kills the application. WWDC 2012 Session Videos: Privacy Support in iOS and OS X Expiration handler: beginBackgroundTaskWithExpirationHandler There is no way … Read more

Get a list of all contacts on iOS

In my original answer, at the end of this answer, I show how to retrieve contacts in iOS versions prior to 9.0 in a manner that addresses some of the problems entailed by other answers here. But, if only supporting iOS 9 and later, one should use the Contacts framework, avoiding some of the annoying … Read more

Android fetch all contact list (name, email, phone) takes more then a minute for about 700 contacts

with the following code for 59 contacts i got the following results on the emulator: D ╔══════ query execution stats ═══════ D ║ got 59 contacts D ║ query took 0.012 s (12 ms) D ╚════════════════════════════════════ ok, that was the best time, but the average is 25-35 ms (for 59 contacts), add the following code … Read more