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.
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.
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.
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"
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:
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.