I've spent the last few hours determining that I am not able to retrieve the phone number from the iOS device.
Where in the policy does it disapprove retrieving the device phone number? (my interpretation of the policy is that its ok to use the phone number as long as its used as part of your service and you have the users consent)
Are their methods to automatically pull the device phone number? (I found 2 deprecated methods but nothing for > iOS 6)
There is no policy disapproving retrieving the phone number because there is no way to get the phone number directly.
There is no way to get it without asking the user for it.
There is no valid reason to ask a user for their phone number. Why do you think you need it? No app should require a phone number to function.
Related
This question already has answers here:
Programmatically get own phone number in iOS
(9 answers)
Closed 5 years ago.
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
You can't. You should ask user for phone number from UI.
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.
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.
i am working on an app in which i take a field of mobile number of user after entering mobile number there is a option for verify phone number.
but i don't know the functionality of how to verify a user's phone number within the app using codes.I search for similar type of questions but didn't get the exact solutions.
i am sending a screenshot of my app where i want to put that functionality.
i didn't apply any codes for this
please help
You need a backend that can generate and save codes for each phone number and also send a text message with those codes. So the flow is as follows:
User enters their phone number in the app and presses the "Verify Number" button.
You send a request to your backend with the number provided. In the app, you also displays a text field for user to enter the generated code and a new button like "Check code".
The backend generates a new code (just a random one), stores it to the database (like ID,PhoneNumber,GeneratedCode,DateOfGeneration) and sends a text message with the code to the phone number specified.
When the user receives the message he or she enters the code to the checking input field and presses the "Check" button.
The mobile app sends another request to the backend with the phone number entered earlier and the code entered by the user now.
The backend looks to the database for the "Phone number" - "Code" pair and responds with failure (the code is incorrect, try again) or success (the phone is verified).
Unfortunately, there's no way to access text messages received by user from within an app on iOS devices (unlike Android). The proof link was already provided. So the user has to manually enter the verification code from the message.
Ok I tell the information how was I already did my project in before
Step-1
when user press the Verify Number button
initially I check the phone number is valid or not(means phone number count/length).
second I generate the random number on progrmatically like NSUInteger r = arc4random_uniform(16);
Step-2
send the random number to server along with the vaild phone number , the server send the random number to the particular mobile number using SMTP Server.
Step-3
in your hand you have the random number , so open the UIAlertview for user type the valid random number , if user typed the vaild number show the Next Screen else show the Alert.
To verify any mobile number you can use third party api's which are available for mobile as well as backend server. You can use Twilio Messaging Api. To use this API follow below steps:
Register account on Twilio and get key from account.
Get user's phone number from mobile application.
When user click on the "Verify Number" button, call web-service with the number.
When you'll call the web-service, write a logic to send the random number with the Twilio messaging api to send message to user.
When user get this number through SMS, You can tell user to enter the number and verify it.
Also, there is another api which you can directly integrate into your mobile application. You can find this Sinch Api here.
To verify against your device's phone number, first, you need to get the phone number from your device and then you can compare against. However, after iOS 4, getting phone number of your device is quite impossible. Even if, you do get the device's number using some private api which I am not sure works entirely, there is a huge possibility for Apple to reject your app.
Refer to the following stack overflow discussion-
Programmatically get own phone number in iOS
Just a suggestion: You probably want to look for a work around based on your business goal. For example, rather than checking for device's phone number directly. You can generate a code and send that to the number specified by the user and then enter that code to verify that the user has that device.
I want to make a joke application for a friend (not for general sale) that looks exactly like the iOS Phone application but so that whatever number is dialled into the application it appears to dial that number but actually dials a preset number in the background.
The way I figured to do it would be through the following:
User enters a number and hits the call button
Save the number entered as a contact's name and programmatically set the number of that contact as the preset number
Get the application to ring the preset number, to which it would switch over to the real iOS phone application and dial, but with it being a saved number in the contacts it will display the name, which is the number entered by the user.
Delete that contact upon re-opening the application as for it to not ask which number to dial the next time.
This is the only way that I can think of pulling this off, but it seems like it will look unconvincing; especially when it switches over to the real Phone application. Can anyone think of a better way? Such as calling from within the application?
I wouldn't usually take junk requests like this but it made me curious as to pull it off best.Thanks
If you are not going to publish this, then there is no reason why you shouldn't use private apis. See this answer (How to directly make a phone call with private API CTCallDial()?)
I am developing an iOS app, where I would need to access the phone number of the user logging in, query the DB to check if the phone number exists as an entry & finally display an alert to the user. Is it possible?
Read Apple response on this kinda app rejection..
"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."
so its not possible to read the user number by your application, best way to ask him to enter and validate at your server end!
More detail about SandBox here
It's not possible to detect phone numbers from an app.
However, there are solutions that allow phone number verification (after the user inputs his phone number) by placing missed calls.
I have used such a solution provided by an India-based company named ZipDial.
Check the section titled "Mobile Number Verification" in the link above.
I need to get the IMEI number and serial number of the SIM card in iOS, i have done this in android using the telephonymanager, but how can i achieve this on iOS?
I need this value because I save it in a data base using a web service, each time a client attemp to log in, so it doesnt matter if the client changes celphone or not, the account will be the same because the SIM card will be the same one.
I have been searching on the web, and found a way with this:
NetworkController.m
But it seems like this class has been removed from the web. Another possible way to achieve my goal is to use:
UIDevice-IOKitExtensions.m
But no documentation is given. Any ideas?
Does apple accepts an app using private framework?
Apple does not allow the use of private framework / api. Also, getting the users IMEI number will cause Apple to reject the app.