发现用户的名字和姓氏?
我正在尝试以编程方式发现 iPhone 用户的名字和姓氏。这有可能吗?称这个...
getpwuid( getuid() )->pw_gecos == "Mobile User"
..唉。迭代地址簿会找到所有地址簿记录,但不区分设备所有者和其他任何人(我可以告诉)。
鉴于 Mac 桌面地址簿在左下角用“我”覆盖层装饰所有者图标,我希望 iPhone 版本中也能提供此类信息。
马丁.
I am trying to programmatically discover the first and last names of the iPhone user. Is this possible at all? Calling this ...
getpwuid( getuid() )->pw_gecos == "Mobile User"
..alas. Iterating over the address book finds all address book records, but doesn't distinguish between the device owner and anyone else (that I can tell).
Given that the Mac desktop address book decorates the owners icon with a 'me' overlay in the bottom-left, I'm hoping that sort of information is available in the iPhone version.
Martin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如另一个线程中所指出的,有 NSFullUserName() - 这个调用确实出现在 iPhone 文档中,因此它应该可以在设备上运行。只需从中解析出名字和姓氏即可。
As noted in the other thread, there is NSFullUserName() - this call does come up in the iPhone documentation so it should work on the device. Simply parse out the first and last name from that.
请参阅类似问题 - 没有适用于该问题的公共 API。
See similar question - there is no public API for that.