Page 1 of 1
Getting the SIM phone number
Posted: Fri Oct 18, 2019 10:38 pm
by simon.schvartzman
Hi guys, as far as I understand the OS doesn't allow the Apps to get the phone number stored in the SIM card, correct?
If this is the case I wonder how WhatsApp is able to automatically find out that the phone number has changed when I replace the SIM card (when traveling abroad for instance).
Looking forward to hear back your remarks, ideas, etc.
Thanks and regards
Re: Getting the SIM phone number
Posted: Sat Oct 19, 2019 10:19 am
by Thierry
simon.schvartzman wrote:
Looking forward to hear back your remarks, ideas, etc.
Hi Simon,
From SO:
You cannot use iOS APIs alone to capture the phone number (even in a private app with private APIs), as all known methods of doing this have been patched and blocked as of iOS 11. Even if a new exploit is found, Apple has made clear that they will reject any apps from the app store for using private APIs to do this. See @Dylan's answer for details.
However, there is a legal way to capture the phone number without any user data entry. This is similar to what Snapchat does, but easier, as it does not require the user to type in their own phone number.
There is even a video there:
https://stackoverflow.com/questions/193 ... ber-in-ios
HTH,
Thierry
Re: Getting the SIM phone number
Posted: Sat Oct 19, 2019 11:04 am
by bogs
Hopefully you'll read the
entire thread Thierry linked to, or at least, the 2nd post which says -
At the risk of getting negative marks, I want to suggest that the highest ranking solution (currently the first response) violates the latest SDK Agreement as of Nov 5, 2009. Our application was just rejected for using it. Here's the response from Apple:
"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.
I'll also note that the information is a decade old, so whether or not any of it still applies is up for grabs. Give Thierry's note a shot, what is the worst that can happen? If the app is rejected, you'll know they are serious about the policy, if not, "caveat emptor!", right?
By the way, I'm curious about how you stated 'Whats app' does this automatically, from their
faq page, it appears far less than automatic...
To change your phone number in WhatsApp, follow these steps:
1. Insert the new SIM card with the new number into your device.
2. Open WhatsApp.
3. Check if your old phone number is currently verified. You can see what number is verified in WhatsApp by navigating to WhatsApp > More options > Settings and tapping on your profile photo.
4. Go to WhatsApp > More options > Settings > Account > Change number.
5. Enter your old phone number in the top box.
6. Enter your new phone number in the bottom box.
7. Tap Next.
If you turn on Notify Contacts, you can choose if you want to notify All contacts, Contacts I have chats with or Custom.
If you select Custom, you'll need to search for or select the contacts you want to notify > tap Done.
8. Tap DONE.
You'll be prompted to verify your new phone number.
...but since I don't have any mobile devices of any kind, I'll take your word it does

Re: Getting the SIM phone number
Posted: Sat Oct 19, 2019 11:20 am
by Thierry
Hi Mister Bogs,
I'll also note that the information is a decade old, so whether or not
any of it still applies is up for grabs. Give Thierry's note a shot, ....
The post you have to look at is from 2018:

- Screenshot 2019-10-19 at 12.17.01.png (13.5 KiB) Viewed 5384 times
and this technic prevents apps to be rejected by Apple
and don't need to enter manually the phone number.
Disclaimer: I've just read the thread, nothing more.
Kind regards,
Thierry
Re: Getting the SIM phone number
Posted: Sat Oct 19, 2019 11:46 am
by bogs
Re: Getting the SIM phone number
Posted: Sat Oct 19, 2019 8:02 pm
by simon.schvartzman
Thanks to all for your answers.
I guess the SMS approach pointed out in the post referenced by Thierry is a good path to be explored. I'll probably try it in the near future.
Regards