有什么办法得到“我”卡从iPhone地址簿API? [英] Is there any way to get the "Me" card from iPhone Address Book API?

查看:124
本文介绍了有什么办法得到“我”卡从iPhone地址簿API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在这一个。

在Mac OS X中,可以通过内置地址簿API轻松获取我卡(Mac /帐户的所有者)。

In Mac OS X there is an easy way to get the "Me" card (the owner of the Mac/account) from the built-in address book API.

有没有人找到一种方法来找出哪个联系人(如果存在)属于iPhone的所有者?

Has anyone found a way to find out which contact (if it exists) belongs to the owner of the iPhone?

推荐答案

您可以使用未记录的用户默认值:

You could use the undocumented user default:

[[NSUserDefaults standardUserDefaults] objectForKey:@"SBFormattedPhoneNumber"];

,然后在地址簿中搜索具有该电话号码的卡。

and then search the address book for the card with that phone number.

请记住,由于用户默认没有文档,Apple可能随时更改,您可能无法访问App Store。

Keep in mind that since the User Default is undocumented, Apple could change at any time and you may have trouble getting into the App Store.

你可以采取的另一种方法,虽然它更脆弱,是看设备名称。如果用户没有将其从默认的用户名的iPhone更改,并且他们使用他们的真实姓名作为iPhone,您可以从中获取用户名。再次,不是通过任何方式的最佳解决方案,但它确实给你别的东西尝试。

Another approach you could take, although it is much more fragile, is to look at the device name. If the user hasn't changed it from the default "User Name's iPhone" AND they are using their real name as an iPhone, you could grab the user name from that. Again, not the best solution by any means, but it does give you something else to try.

这个问题的普遍接受的答案是提交一个雷达苹果此功能并提示用户选择自己的卡。

The generally accepted answer to this question is to file a Radar with Apple for this feature and to prompt users to choose their card.

这篇关于有什么办法得到“我”卡从iPhone地址簿API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆