Any way to get the name of iPhone user?

Andrew picture Andrew · Jun 3, 2013 · Viewed 15.3k times · Source

Outside of asking the user to input their name, is there any way to get it off the device?

I tried this library, which attempts to extract the name from [UIDevice currentDevice] name], but that doesn't work in a lot of situations:

https://github.com/tiboll/TLLNameFromDevice

Is the user's name present in the phonebook or anywhere else that we have access to in iOS 6?

Answer

rckoenes picture rckoenes · Jun 3, 2013

Well you could go through all the contacts in the AddressBook and see if any of them are marked with the owner flag.

Just be aware that doing this will popup the "this app wants access to the address book" message. Also Apple isn't very keen on these kind of things. In the app review guide it is specified that an app can not use personal information without the user's permission.