How do I open the Contacts app Swift

百般思念 提交于 2021-02-05 08:25:27

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/46761150/how-do-i-open-the-contacts-app-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!