How to retrieve the user’s phone number programmatically in iphone application?

StackOverflow https://stackoverflow.com/questions/933509

  •  06-09-2019
  •  | 
  •  

Question

As title how to? I have tried the code from others sources:

id number = [[NSUserDefaults standardUserDefaults] objectForKey:@”SBFormattedPhoneNumber”];

NSLog(@”user phone number is %@”, number);

However it return NULL even thought I tested on device with firmware 2.2.1. Any idea?

No correct solution

OTHER TIPS

I don't believe it is possible with the 2.2.1 SDK.

Wil Shipley worked very hard on this and talked about it at his presentation to a bay area cocoa heads group back in april. Google wil shipley cocoa heads vimeo if you want to watch it.

I haven't tried myself.

I had the same issue and resolved it by setting the number on the phone. By default I do not think that the number is set on the iPhone but that can resolved by going into Settings->Phone->My Number.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top