-2

I need to retrieve "My Number" from AddressBook but I can't find out how to do so. When accessing the contacts in AddressBook, I managed to get all the contacts but I don't know how to get the "My Number". I know it's accessible as for instance on my phone, it is categorised under my first and last name and therefore I manage to take it from there. But I would like the standardised way to access the "My Number".

Thank you infinitely for your help,

jim
  • 69
  • 9

2 Answers2

0

"For security reasons, iPhone OS restricts an application (including its preferences and data) to a unique location in the file system. This restriction is part of the security feature known as the application's "sandbox." The sandbox is a set of fine-grained controls limiting an application's access to files, preferences, network resources, hardware, and so on."

The device's phone number is not available within your application's container. You will need to revise your application to read only within your directory container and resubmit your binary to iTunes Connect in order for your application to be reconsidered for the App Store.

Irfan
  • 432
  • 1
  • 6
  • 17
  • 1
    This answer is not directly applicable to this question. The question asks about the Contacts and AddressBook frameworks, which provide the app with a way to view the user's contacts (which can have a contact representing "Me", so the OP's question is valid). The sandboxing doesn't really apply to this situation. – erdekhayser Dec 05 '15 at 17:15
0

This is not allowed. There is no public API to get user's phone number. There are few open question on SO that cover this theme. For example this.

Community
  • 1
  • 1
rkyr
  • 3,131
  • 2
  • 23
  • 38