Square 的 CardCase 应用程序如何自动从地址簿中填充用户的详细信息?
Square 的新卡盒 iOS 应用程序具有“创建帐户”功能。点击它,它会显示一个预先填充了地址簿中用户条目的表单。
这怎么可能?有人知道吗?我认为这是不可能的,以这种方式获取用户的信息。事实上,这不是 iOS 5.0 的事情。
Square's new card case iOS app has a "Create Account" feature. Tap it and it shows a form PREPOPULATED with the user's entry from the Address book.
How is this possible? Anyone know? I thought this was unpossible, to get the user's info this way. It's not an iOS 5.0 thing, afaict.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我有同样的问题,但在 Swift 中,并使用了 Nik Burns 的建议并写了一篇关于它的博客文章: http://paulpeelen.com/2016/01/20/prefill-an-signup-form-in-ios-using-swift-and-cncontact/
这基本上就是最终结果在 Swift 中:
以及扩展名:
I had the same issue, but in Swift, and used Nik Burns suggestion and wrote a blog post about it: http://paulpeelen.com/2016/01/20/prefill-an-signup-form-in-ios-using-swift-and-cncontact/
This is basically the end result in Swift:
And the extension:
我能想到的唯一解决方案是使用设备名称,然后在地址簿中搜索匹配项。这假设有人会使用特定的命名约定。例如,我使用“Nik's iPhone”作为我的设备名称。我也是地址簿中唯一的 Nik,因此对于我的情况,使用 之前的文本作为所有者名称效果很好。
它使用了 Erica Sadun 的 ABAddressBook 的非常方便的包装器,ABContactHelper。
我保留了枚举代码,而不是使用 0 处的数组索引,因为可能会返回少量匹配项,因此您可以进行扩展,为用户提供选择“他们的”详细信息的选项。虽然与方形外壳解决方案不完全匹配,但效果很好。恕我直言。
the only solution I could come up with was using the device name and then searching the addressbook for a match. this assumes someone would use a particular naming convention. I for example use 'Nik's iPhone' as my device name. I am also the only Nik in my addressbook, so for my scenario is works well to use the text prior to 's as the owner name.
It makes use of the very handy wrapper for ABAddressBook by Erica Sadun, ABContactHelper.
I've left the enumeration code in instead of using array index at 0 as likely a small number of matches will be returned so you could expand to give the user an option to choose 'their' details. Which whilst not exactly matching the square case solution works well. imho.
由于更改要求应用程序请求访问地址簿的权限,因此此方法不再有效。尼克伯恩斯的答案非常有效,但它需要访问地址簿。
我下载了 Square Wallet(它是原始问题中 Square Card Case 参考的后续版本),它不再预先填充注册表单。路径还用于执行设备名称地址簿技巧,但它也不再预先填充注册表单。
使用上述方法,您仍然可以之后预先填充注册表请求联系人访问,但它失去了所需的“神奇”体验。
Since the changes that require apps to ask for permissions to access the address book this method no longer works. Nik Burns' answer worked great, but it needs access to the address book.
I downloaded the Square Wallet (which is the successor to Square Card Case references in the original question) and it no longer pre-populates the sign up form. Path also used to do the device name address book trick but it also no longer pre-populates the sign up form.
Using the above method, you could still pre-populate the sign up form after requesting Contacts access but it loses the desired "magic" experience.
由于我对必须使用设备名称不满意,因此我选择使用地址簿中对应于“ME”的第一条记录
Since I was not happy with having to use the device name I chose to use the first record of the address book which corresponds to "ME"
不,你可以
http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Introduction.html#//apple_ref/doc/uid/TP40007744
我知道这是在 4.X 中可用;不仅仅是 5.0 的功能...不确定它是否更早可用。
No you can
http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Introduction.html#//apple_ref/doc/uid/TP40007744
I know it was available in 4.X; not just a 5.0 feature... Not sure if it was available earlier.