iOS 上地址簿中的用户信息
在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕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.