Find Favorite contacts from the iOS Address Book API - ios

Is there a way to find Favorite contacts from the iOS Address Book API? I'm referring to the contacts a user places in his Favorites tab in the Contacts app.

Favorites are stored inside Phone.app, not inside the Address Book database itself. You can't access other app's sandbox on a non-jailbroken iPhone, so unfortunately the answer is no.
Also, it would be pretty bad for privacy if any app could see your favorite contacts. It's already bad that it can access entire address book without asking you.

Filip is correct, you cannot access the list of favorite contacts on iOS via a public, app-store legal API.
To come close you could try to guess a user's favorite or most important contacts from their address book. Let's assume that people know most about the people they are closest to and that this is also reflected by their phone's address book:
For example, the address book contact for a close friend contains more
information (address, birthday, maybe a nickname) than a contact for a
business associate or a colleague at work.
We could then use this information to compute an importance score for each address book contact. By taking the n most important contacts we could approximate a user's favorite contacts.
I've written about this idea some more on my blog: http://dbader.org/blog/guessing-favorite-contacts-ios You can also find a sample implementation and a demo application there.

I have searched through the API and could not find any appropriate methods. Maybe Apple believes that this is a Phone-app data field or maybe it is about security. I'd love to use it, too.

Related

Requesting data about user iOS

Is there an API in iOS which would allow me to discover information about the user who owns the phone?
The address book api would allow me access to their contacts, but how would I find out about the self user?
Thanks!
You could go through all the contacts in the Address Book and see if any of them are marked with the owner flag.
Edit
This was removed a while back, another way is getting the device name
UIDevice.currentDevice().name
"Bob's Iphone"
Then you could cylce through the address book and find a bob, this is a solution i wouldn't recommend, the best bet might be to ask the user for their details
Well there's not much more you can get from a user due to them wanting their privacy but there are a couple of things you can still find out about a user:
Get Device Info (find out more about their device)
HealthKit API (Get users health data like how many steps they make what they eat and drink etc)
Photo Album Access (access to their photos and videos)
That's about it really! Hope it helps :)

iOS : Get favorite contacts list in Contacts Framework [duplicate]

Is there a way to find Favorite contacts from the iOS Address Book API? I'm referring to the contacts a user places in his Favorites tab in the Contacts app.
Favorites are stored inside Phone.app, not inside the Address Book database itself. You can't access other app's sandbox on a non-jailbroken iPhone, so unfortunately the answer is no.
Also, it would be pretty bad for privacy if any app could see your favorite contacts. It's already bad that it can access entire address book without asking you.
Filip is correct, you cannot access the list of favorite contacts on iOS via a public, app-store legal API.
To come close you could try to guess a user's favorite or most important contacts from their address book. Let's assume that people know most about the people they are closest to and that this is also reflected by their phone's address book:
For example, the address book contact for a close friend contains more
information (address, birthday, maybe a nickname) than a contact for a
business associate or a colleague at work.
We could then use this information to compute an importance score for each address book contact. By taking the n most important contacts we could approximate a user's favorite contacts.
I've written about this idea some more on my blog: http://dbader.org/blog/guessing-favorite-contacts-ios You can also find a sample implementation and a demo application there.
I have searched through the API and could not find any appropriate methods. Maybe Apple believes that this is a Phone-app data field or maybe it is about security. I'd love to use it, too.

How to check address book against my application

In my app, I need to check address book and if ;
a person from address book is installed my app, user will be able to send a friend request,
a person from address book is not installed my app, user will be able to send an sms to relevant person to install the app.
This is actually same as Snapchat. So, what is the proper way to implement it ?
For instance, should I get phone number of the installer and record it to Users table in database ? Then when another user install the app, check all address book against Users table in DB and mark them application installed or not !
Maybe, there is an easy way to do it. So, please help me and provide some sample code for it.
Looks like you can use
CloudKit for the first question part:
discoverAllContactUserInfosWithCompletionHandler
https://developer.apple.com/library/ios/documentation/CloudKit/Reference/CKContainer_class/#//apple_ref/occ/instm/CKContainer/discoverAllContactUserInfosWithCompletionHandler:
You can get users that are also use your app.
For the second part, you can just use Address Book api I think to get all persons in the AB without your app.
https://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Introduction.html
Address Book is deprecated (or will be), so take a look at this WWDC 2015 video Contacts framework: https://developer.apple.com/videos/play/wwdc2015-223/

Getting contacts who own an iDevice

Is there a way through addressbookUi framework to get only the contacts who own an iDevice? The check for example is done in the messages app for iMessage. But is this available for developers? Or is there another way to check for this? Thank you in advance..
You could check, for each address book record, if there is a phone number of type "iPhone" (represented by the constant kABPersonPhoneIPhoneLabel). There's really no way of knowing for sure which of the contacts "owns an iDevice" anyway, but if there is an iPhone number for them in the address book record, then there's a good chance of them using an iPhone. Of course, it's another story altogether how that information got in your address book, and whether it is reliable.
No there isn't... The SMS app would be checking with apples servers to see if the phone number is registered with iMessage or not.
This is not a publicly accessible API.
I guess you could hash then send the users number to your own remote database and then compare contact numbers in another users address book against your database to see if they are users of your app... It's not really what you asked to do but it's the closest solution I could think up

Is there a way to access the user's own address book data (first & last name, e-mail) in iOS?

I want to prefill some input fields in an app's registration process in order to make it more seamless. Is there a (Apple authorized) way to access this data?
Thanks,
Georg
No, what you want to do is an often requested feature, but for reasons unknown (probably security related) there is no way to even determine if the phone's owner has an address book entry. I suggest you go to bugreporter.apple.com and ask for this feature (as many of us already have!)
I think you need to pre fill the values from your device's address books. If so you have to dig your head into AddressBook Framework in order to access the contact details. Below link is from iOS developer link
http://developer.apple.com/library/ios/#documentation/AddressBookUI/Reference/AddressBookUI_Framework/_index.html
http://developer.apple.com/library/ios/#documentation/AddressBook/Reference/AddressBook_iPhoneOS_Framework/_index.html#//apple_ref/doc/uid/TP40007212

Resources