iOS open contact in address book - ios

Since apple doesn't allow apps to directly call service methods using NSURL, I have a contact saved into the users addressbook which can call a service number.
However, if I open the contact (using ABUnknownPersonViewController) I cannot call the service number.
My question: Is there some way I can switch to the address book app and show a contact there? I don't want to tell the user "Open your adress book and search for contact X".

To reply to your question:
No, there is no way to open separately the contact address book.
However:
You can simply take that number programmatically and use it as you want (also call).

Related

Save a contact on iOS using QR [duplicate]

Is there a URL to open the contacts application from within my application? I know you can achieve this with the settings app by using the UIApplicationOpenSettingsURLString constant in Swift; however, I wasn't sure if I could do the same with the Contacts app.
There isn't a deep link for opening the Contacts App.
Apple is very picky when it comes to deep-linking. They have to provide one for Settings since many apps need services like Data, Location, Bluetooth, Wifi, etc.
Unfortunately they do not extend this to the Contacts App.
However if your app needs contact information then for that Apple has provided a Contacts framework to browse through your contacts within your app itself.
Read more about it here.
In order to add/update/delete/merge contacts directly from your app without using the Apple's Contact UI, use the CNSaveRequest APIs. More on that here.
The closest thing you can get to opening a contact is to write them a message in IMessage. From this screen the user can press the contact icon and open the contact page for that particular contact.
You can do this by opening the url sms://+44776382223 where the number is the number of the person that you would like to view the contact of.

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/

Populating user details from the contact list

I am working on an app and need to make the user enter information like name, phone, address etc. Inside my app is it possible to show the contact list (Address book) and make the user pick the contact he wants to use. I am specifically hoping to find a way that also give me the UI and search functionality within the contacts just like the regular contacts list. So when the user wants to enter the information, I show him the contacts list (with the same UI/functionality or a subset of it) and let him pick the contact. Is there a way to do this in iOS?
Address book is there. USe that .
This answer can help you.
Get a list of all contacts on iOS
Fetch Contacts in iOS 7
How to simply retrieve list of Contacts in iOS7?
If, you want a tutorial, here is the link Tutorial link

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