iOS 上地址簿中的用户信息

发布于 2024-11-06 15:12:37 字数 573 浏览 5 评论 0原文

在 MacOS XI 上可以使用 ABAddressBook 类中的方法 me 来获取登录用户的记录,参见 Apple 文档。在 iOS 上,文档。 iOS 通讯录似乎不会在同步时保留此信息。

有没有办法在 iOS 下识别用户,或者我是否需要为我的每一个应用程序设计一种专有机制?

On MacOS X I can use the method me in the ABAddressBook class to get the logged in user's record, see Apple's documentation. On iOS there is no similar function call (in the corresponding C interface) listed in the documentation. The iOS address book does not seem to preserve this information upon synchronization.

Is there any way to identify the user under iOS or do I need to devise a proprietary mechanism for every single one of my apps?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜心小果奶 2024-11-13 15:12:37

恐怕iOS并没有提供归还失主名片的方法。我希望您能够获取设备的电话号码,然后在地址簿中搜索相同的号码。

通过这段代码可以找到设备的电话号码
NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];

不幸的是,获取设备的电话号码违反了开发者协议。苹果将​​拒绝任何使用它的应用程序。

抱歉,我的回答是“不”。至少我们现在都知道什么是行不通的。

I'm afraid iOS does not offer a method to return the owner's contact card. I was hopeful you could get the device's phone number and then search for the same number in the address book.

The device's phone number can be found with this bit of code

NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];

Unfortunately getting the device's phone number is a violation of the developer agreement. Apple would reject any app that used it.

Sorry for the "no" answer. At least we both now know what doesn't work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文