Reputation: 10759
So I have a button in my app that people can click which is suppose to open the chat app and allow the user to send a text to the number I specify.
Here is the code:
NSString *phoneNumberStuff = [NSString stringWithFormat:@"tel:%@",self.driverPhoneNumber];
NSString *stringURL = [NSString stringWithFormat:@"sms:%@",phoneNumberStuff];
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
What happens is when I click the SMS button it opens the texting app and I see in the TO: field the correct phone number to text a message to. So I type a message and hit send, but I get this response back.
"15558354439876552 Error Invalid Number. Please re-send using a valid 10 digit mobile number or valid short code. text again"
Anyone have a clue?
Upvotes: 0
Views: 321
Reputation: 1743
Your format for the url isn't correct.
You are using
sms:tel:1234567890
When you should use
sms:1234567890
Upvotes: 1