Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios 11 sms app param does not work

Tags:

ios

iphone

sms

<html>
<body>
  <a href="sms:+24321&body=This%20is%20the%20body">Click Me!</a>
</body>
</html>

When you click the link above, iOS successfully opens the native iOS Messages application. If the user previously had the iOS Messages app open in the background on their phone, then iOS properly passes in the query parameters contained in the link, e.g. to: (24321) and body: (This is the body), but if the user does NOT already have iOS Messages open, then iOS opens Messages, but does NOT open a message w/ to and body filled out.

This is not an issue on iOS 10, it seems to have been introduced in iOS 11.

like image 781
Apurv Avatar asked Nov 07 '17 17:11

Apurv


1 Answers

It is clearly an iOS 11 bug.

The same bug there is with the openURL, with this code, without the if state, we have the same results:

NSString *sms = @"sms:+1234567890&body=This is sms body.";
NSString *url = [sms stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0)
{
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}

With a double call it firstly open the message app and then pass the right parameters.

With a double call it works but it is a BAD workaround!

The same should happens with a web code.

I can only advise you to report a bug to Apple at this link.

This answer is not for the bounty, I just wanted to share with you my test. ;)

like image 111
Kerberos Avatar answered Oct 04 '22 21:10

Kerberos