-1

I have been looking a bit around for a way to retrieve the phone number of an iOS device but without too much sucess as I've seen mixed reports

According to this link it's a no : Programmatically get own phone number in iOS

Also here https://www.npmjs.com/package/cordova-plugin-sim I don't see any information about the phoneNumber for iOS.

However, as these links aren't brand new, I would like know if things have changed since

Scipion
  • 11,449
  • 19
  • 74
  • 139
  • Why do you want to retrieve phone number? – Swapnil Patwa Feb 05 '18 at 07:31
  • 1
    I mean, I mentionned this post saying that I am not sure if I can rely on since it is very old. There is no need to mark it as duplicate and even less to close this question. – Scipion Feb 05 '18 at 10:13

3 Answers3

1

First of All, its impossible to get Phone number in iOS programatically. iOS don't allow such things. You can get the carrier name of the mobile number.

If you really want to get the Mobile Number, then you have to ask the user to send a message on a number which will be configured with your backend service. Once the message reaches to the number in Your backend System , you can get the mobile number from the backend with a Service call.

Nilesh Jha
  • 1,626
  • 19
  • 35
  • if this methods works, it's seems silly for iOS to prevent software to get it directly since it's obtainable anyways... And with respect to the "Privacy" you should ask the user if he wants to share info or not... Antoher "Caprichapple"... – Ari Waisberg Nov 23 '18 at 15:00
1

NO, this not possible as Apple wants to respect the privacy of their users. You can't access the phone number from public API, so you cannot.

Anuj.T
  • 1,598
  • 16
  • 31
1

You can't. You should ask user for phone number from UI.

totocaster
  • 6,243
  • 5
  • 37
  • 46
  • If i want to id the user he could easily lie to me... I found very necesary to validate (not from the user) if this is his number... – Ari Waisberg Nov 23 '18 at 15:02