How do you access the current user's record in Address Book?

偶尔善良 提交于 2019-12-22 06:32:13

问题


Is there a way in the Address Book API to access the current user's record programatically? In other words, if this iPhone belongs to John Smith, to get the contact record that is John Smith (whichever record is marked as Me in Contacts)?

Obviously you can popup the picker and let the user select themselves from their Contacts, but this seems like an unnecessary action for the user to take.

Use case: I have a form in my app and I'd like to pre-populate the form for the user based on their contact info they've already entered. It would be nicer to just display this for them than make them go through all of their contacts and select themselves.


回答1:


There is no access to the users address book card. The reason is that Apple don't want apps to have the ability to see potentially personal information without the user first giving the app access to that information.

I, for one, would not want an app to be able to read my email address, phone number, and home address from my card and do what it pleases with it unless I said it could in the first place.

For that reason, you will have to present the user with the address book picker and allow them to select their address book entry.



来源:https://stackoverflow.com/questions/3642968/how-do-you-access-the-current-users-record-in-address-book

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