2

Possible Duplicate:
Programmatically 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?

Community
  • 1
  • 1
user758741
  • 55
  • 1
  • 1
  • 2
  • Also, user758741, there's a good chance your dialer may be rejected from the app store. They rejected Google Voice, and I've heard rumors of other dialers being rejected. However, there is a Skype app, and they support voip-based apps. – Tyler May 18 '11 at 08:17
  • This question is answered in depth on another thread. Check it out at: http://stackoverflow.com/questions/193182/programmatically-get-own-phone-number-in-iphone-os – gadildafissh May 23 '12 at 14:51

2 Answers2

5

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?

Claus Broch
  • 9,212
  • 2
  • 29
  • 38
3

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.

rckoenes
  • 69,092
  • 8
  • 134
  • 166