How can I get the phone number of my iPhone device? [duplicate]
Possible Duplicate:
Progra开发者_如何学编程mmatically get own phone number in iPhone OS
I am new in iPhone technology. I am currently building a dialler application in which requires the phone number of my iPhone form my SIM card.
How can I get the phone number of my iPhone device?
The phone number is not accessable from any Apple public API which means you can't get it.
If you are implementing a dialer application I can't see what you would nee the own phone number for. It's not like you are going to call yourself?
You can get the users phone number from the NSUserDefault:
[[NSUserDefaults standardUserDefaults] objectForKey:@"SBFormattedPhoneNumber"]
But this will only work if the user has entered his phone number. There is no way in the official SDK to read anything from the SIM card.
精彩评论