简体   繁体   English

iOS上的地址簿中的用户信息

[英]User information in address book on iOS

On MacOS XI can use the method me in the ABAddressBook class to get the logged in user's record, see Apple's documentation . 在Mac OS XI可以使用的方法meABAddressBook类来获取登录的用户的记录,看看苹果的文档 On iOS there is no similar function call (in the corresponding C interface) listed in the documentation . 在iOS上, 文档中没有列出类似的函数调用(在相应的C接口中)。 The iOS address book does not seem to preserve this information upon synchronization. iOS地址簿似乎在同步时不保留此信息。

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? 有没有办法在iOS下识别用户或者我是否需要为我的每一个应用程序设计一个专有机制?

I'm afraid iOS does not offer a method to return the owner's contact card. 我担心iOS不提供退还所有者联系卡的方法。 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. Apple会拒绝使用它的任何应用程序。

Sorry for the "no" answer. 抱歉,“不”回答。 At least we both now know what doesn't work. 至少我们现在都知道什么是行不通的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM