4

Can I get user's mobile number (CLI number) in Objective-C on the iPhone from its sim card?

Ilker Baltaci
  • 11,644
  • 6
  • 63
  • 79
  • Isn't this a dup of http://stackoverflow.com/questions/193182/programmatically-get-own-phone-number-in-iphone-os ? – JeffH Mar 22 '09 at 00:35
  • interesting read: http://www.kuberan.me/2011/03/your-mobile-numbers-are-being-stolen-by-websites/ – Phill Pafford Mar 31 '11 at 13:39

2 Answers2

5

Not with the official SDK. You could ask the user to point to its own contact entry using the AddressBookUI framework's pickers, or a UI of your own design.

millenomi
  • 6,569
  • 4
  • 31
  • 34
  • In fact, ICE (one of the apps in the store) does exactly this - it asks the user to pick themselves out of the contacts. – nsayer Oct 01 '08 at 20:35
3

You can get the user's phone # from NSUserDefaults. And then look up their address book entry.

This method is completely undocumented and liable to break at a moments noticed.

Also it is fragile - user might have a bad address book with the same # used multiple times etc.

schwa
  • 11,962
  • 14
  • 43
  • 54