I am trying to store a phone number as an NSString in NSUserDefaults. For some reason the code below does not work. The code works if I do not use a variable, but I cannot get it to work. Does anyone have any ideas why?
NSString *savedPhone = [[NSUserDefaults standardUserDefaults]
stringForKey:@"savedPhone"];
NSString *callNumber = [NSString stringWithFormat:@"%@%@",@"tel://",savedPhone];
NSURL *myURL = [NSURL URLWithString:callNumber];
[[UIApplication sharedApplication] openURL:myURL];
Please let me know if anyone has any ideas. Thank you!
You can achieve with below code:
Then add below function:
This will resolve your issue.
Cheers!