how to retrieve the user phone number programmatically?

NSString *phoneNumber = [[NSUserDefaults standardUserDefaults] objectForKey:@”SBFormattedPhoneNumber”];

NSLog(@”Your phone number is %@”, phoneNumber);

Check these two links:

Blogged with the Flock Browser

5 Responses to “how to retrieve the user phone number programmatically?”

  1. Peter Says:

    This does not work in my app, the SBFormattedPhoneNumber key is not present in the standardUserDefaults dictionary. I only see following keys:

  2. babyfish0226 Says:

    Not work in 2.2.1.

  3. Dan Says:

    This only works on a real iPhone device, not in the simulator. You can code your app to handle the missing value and return a dummy value for debugging and testing. I’ve verified this in all released versions of the iPhone OS.

  4. Benoit Says:

    Well I does not seem to work on OS 3.0. I tested it on my device. Has anyone managed to get this on 3.0?

  5. Michael Says:

    This number is only there on a large percentage of iPhones, for others it is not there.

    It is set in the for those of you who don’t have it set on your particular device and you want it to be.

    You may face rejection from apple if they catch you doing this.

Leave a Reply to Dan Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: