Getting contacts who own an iDevice - ios

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

Related

CloudKit: can't discover identities

Pretty new to CloudKit. Trying to get all the contacts who are using my app. According to the docs and the tutorials out there I'm calling this:
discoverAllIdentities(completionHandler:)
The issue is that only my user (the one who is logged in on the device where the app is running) is returned. So I did some digging and noticed that if I call this one:
discoverUserIdentity(withPhoneNumber:completionHandler:)
and I use phone number directly the user is returned.
So after more investigation, I figured that the reason I do not get those users is that in my Contacts those users do not have their iCloud email stored. So once I add the email, they are returned by discoverAllIdentities(completionHandler:). So it appears the default implementation of that method is tied to iCloud emails for the discovery instead of phone number.
Is it possible to use phone number for discoverAllIdentities(completionHandler:)? Since, I don't think that as you add a new contact you would record anything but just phone number, so you will be missing to discover all those users.
Any kind of help is highly appreciated.

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.

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

Use ABAddressBook to get the iPhone user in iOS [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How does Square's CardCase App Do This?
Is this forbidden? Square's iPhone App CardCase seems to be doing this when you create an account. It prefills fields with your email address, photo, and name from the iPhone's address book.
If not forbidden, how does one accomplish it?
Edit: I suspect they are doing this:
Programmatically get own phone number in iOS
and then looking for the phone number in the address book.
Getting Address Book information is not prohibited, in fact, there is a framework dedicated to the Address Book. See ABAddressBook Class Reference. Also, there are a ton of examples on the net that demonstrate how to access the address book, getting entries as well as adding entries.
There are several questionable methods for obtaining the current user's name or email which you could then use to look up their full contact details. However, these run you the risk of getting rejected by Apple. Instead, I would recommend asking for something simple (like phone number) to start off with and using that entered information to try to helpfully autofill the rest. Or assuming you are creating accounts for the user you could use Facebook, Twitter, Google and/or some other 3rd party authentication system instead of requiring all of their details again for your specific app.

Find Favorite contacts from the iOS Address Book API

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.

Resources