Get the device's phone number programmatically [duplicate] - iphone

This question already has answers here:
Programmatically get own phone number in iOS
(9 answers)
Closed 9 years ago.
I need to get my iOS device's phone number programatically.
Via google I found this code:
NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:#"SBFormattedPhoneNumber"];
NSLog(#"Phone Number: %#", num);
But somewhere I read that if I use this code, Apple will reject my app.
Is there any way to get current device phone number without user entry?

No, the device's phone number is not available programmatically and still be approved by Apple, thankfully. I definitely don't want some free app I download out of curiosity to grab my phone number and start sending me spam SMS messages or have marketers calling me.

Your already have the answers:
Can any one pls help me is there any
way to get current device number
without user entry.
Yes, using the piece of code you have in your question.
And, YES, if you get phone number programmatically WITHOUT user input, your App will be rejected by Apple.
This is plain and simple.
If you need the number, ask for it from the user. If they trust you, they will input the number.

Related

Record the conversation of phone - ios [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is an iPhone Call Recorder theoretically possible?
I am an iPhone devleoper.
I want to record the conversation during phone call.
I don't know apple is allowing to do this or not.
If yes, than can anybody guide me how can i do this?
Basically In my app ,I am recording 1 audio .
Now when i call someone from my contact ,I want to play that audio as well as record the conversation.
Both play and record thing I want.
I am confused whether it is possible or not.
There is no public API for recording the calls made (or received) by the built-in Phone app.
You will have to implement your own phone calling mechanism. You'll probably want to use VoIP. (That is what Google Voice uses, for example.) You'll need to run your own server on the Internet, or contract with an existing VoIP service. You'll want to use in-app purchase to let the user buy minutes, because it costs money to run your own server or use a third-party service.
There is no public API for this. No app headed for the App Store can record phone calls made with the standard Phone app.

How to retrive unique identification from iphone/ipad? [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
iOS hardware parameters for unique id generation
I need to identify uniquely the IOS device instead of requiring sign-up in order to uniquely identify the consumers of my app, this data will be send to our servers by consuming WCF service actions.
How can I identify that?
PS. IP is not an option
UDID ([UIDevice currentDevice].uniqueIdentifier;) is deprecated, so i can't recommend you to use that...
What we do in our app is we generate a UUID and store it on the keychain, that together with a customer ID makes every "Profile" unique...
CFUUIDRef uuidObj = CFUUIDCreate(nil);//create the new UUID
NSString *uuidString = (NSString*)CFUUIDCreateString(nil, uuidObj);
P.S. Beware that apple does not like you to tie a user to the device, so better be prepared to explain why you need this.
If you're going to be only supporting iOS6 you can use the UIDevice identifierForVendor.

How can I get my own cell phone number? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Programmatically get own phone number in iPhone OS
I want to get my own cell number in the app. Is there anyway to get it programmatically without taking input from user.
Luckily, there's no official way and your app will get rejected if you use one of the unofficial ways. Even if you think you have valid use case, it's a big privacy issue and the risk of abuse is too high so there is no official way to get the number. If your app or service needs this number to provide all the features you want to offer you need to ask the user to enter it into a textfield (and thus giving him a chance to deny you this information).

iPhone Data Usage Monitoring [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
iPhone Data Usage Tracking/Monitoring
I'm trying to build a "Data Usage Monitoring" iphone app as a quick demo, but haven't been able to figure out how to get CellularData/Wifi usage statistics programmatically.
I know this is possible, as there are several apps in the app store for this (DataUsage, DataMan).
I know for a fact that these are not scrapping the cellular provider's pages to get the data usage, so I'm wondering how they are able to achieve this.
Couldn't find anything in the iOS 4.2 SDK Documentation.
I'm guessing they are somehow getting the data that is displayed under "Settings -> General -> Usage",
Hey, this is sort of untested - I tried it on the simulator, but it obviously doesn't store any data usage statistics. Try to give this code a shot on an iPhone device.
NSLog(#"Contents of the user defaults: %#", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);
It should print out the entire contents of the users preferences. You should then be able to dig out the appropriate keys for accessing the data you need.
Tell me whether it works or not :D

Is it possible to read the iPhone phone number out of the settings?

I would like to pre-populate a UITextfield with the phone number of the current iPhone device. Can that be done?
I doubt it and I certainly hope not. Imagine that I download an app and it automatically transmits my phone number to a remote server.
Actually it looks like it might be/have been possible: http://www.alexcurylo.com/blog/2008/11/15/snippet-phone-number/
hmm just found this post. The answer is that it can be done but we are not supposed to do it...
Programmatically get own phone number in iOS
tnx for reading
It's possible but it's not going to be approved for App Store if you do it.