更改地址簿/联系人中的所有号码
我试图对地址簿中的所有号码进行统一更改,我想将我的国家/地区代码 (+46) 添加到以 0 开头的所有号码,并认为我会为此制作一个应用程序。问题是如何以最好的方式做到这一点,这似乎有点困难。
有没有办法循环遍历地址簿中的所有号码,更改它们/它,然后将它们放回去?
预先感谢您,托比亚斯·托维达尔。
I'm trying to give a uniform change to all the numbers in my address book, I want to add my country code (+46) to all number starting with 0 and thought I'd make an app for this. The question is how to do this in the best way, it seems kind of - hard.
The usual way seems to be through a person picker: http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/UI_Controllers.html#//apple_ref/doc/uid/TP40007744-CH5-SW4 - but this means the user has to pick the contact that it wants to change, which must be an overcomplicated way of doing this.
Is there a way to loop through all the numbers in the address book, change them/it, and then put them back?
Thank you in advance, Tobias Tovedal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以循环浏览所有记录,并可以编辑地址簿中的记录。以下是从地址簿中获取所有记录的示例:
以下是根据人员的 recordID 从地址簿中编辑特定记录的代码:
您可以获取数组中的记录,然后更改电话号码的值,也可以遍历一一记录。在获取一个人的电话号码时需要小心,因为一个人可以有多个电话号码,因此,在获取电话号码时需要使用 ABMultiValueRef,它将给出一个人的所有电话号码。
Yes, you can loop through the all records and can edit the records from the addressbook. Following is the example to get all records from addressbook:
Following is the code to edit a particular record from the addressbook on the basis of person's recordID:
You can either take the records in array and then change the values of phone number or traverse through the records one by one. you need to take care while taking the phone number of a person as a single person can have multiple phone numbers so, you need to use ABMultiValueRef while getting the phone number which will give all the phone numbers of a person.