Quick one liner for you today: Ever wondered how to retrieve the user’s phone number programmatically? Well, here’s the trick:
id number = [[NSUserDefaults standardUserDefaults] objectForKey:@”SBFormattedPhoneNumber”];
NSLog(@”user phone number is %@”, number);
Run that and you’ll get output like
user phone number is 1 (555) 555-5555
Beats the heck out of asking the user to select their own address book entry or something like that, doesn’t it now?
h/t: iphonesdk!
15
NOV
NOV
7
Share