How to get own mobile number from the iOS Device programmatically?

20,632

Solution 1

The phone number is not accessible from any Apple public API which means you can't get it.

Solution 2

The mobile number cannot be accessed without using any private API using which would lead to app rejection. link

Solution 3

This is not possible to get phone number of the device

Refer this link

Programmatically get own phone number in iOS

Get the device's phone number programmatically

Share:
20,632
Gopal Devra
Author by

Gopal Devra

Currently a Software Engineer at Hughes Systique Private Limited. https://twitter.com/gopal_devra #SOreadytohelp

Updated on May 18, 2020

Comments

  • Gopal Devra
    Gopal Devra about 4 years

    I want to get my own contact number for my app.

    I have read some answers on the stack overflow but those were old.

    So please let me know according to new guidelines of Apple, can we get mobile number?

  • Gopal Devra
    Gopal Devra over 7 years
    I read this link stackoverflow.com/questions/19504478/… but as suggested that app must be rejected that is why I am asking for.
  • aqavi_paracha
    aqavi_paracha over 5 years
    It's now possible in Xcode - check this - stackoverflow.com/a/54004224/536214
  • Vishnu Kumar. S
    Vishnu Kumar. S over 5 years
    @aqavi_paracha: It's not possible, the link you shared above shows how to set the content type for UITextField. It doesn't mean that you can fetch the phone number from the device. Apple won't let you to do so :)
  • aqavi_paracha
    aqavi_paracha over 5 years
    @VishnuKumar.S . Yeah but when you set contentType to Mobile field, iOS gives you option to select Mobile number in mobile field, like we used to do in Web. So basically you get mobile number of the phone you're using the app in.
  • KoreanXcodeWorker
    KoreanXcodeWorker about 5 years
    In this case, 'This' should be 'It'.