Passing URL parameters with LSApplicationQueriesSchemes

In iOS9, what is the recommend way to whitelist applications using LSApplicationQueriesSchemes? It doesn't seem possible to specifiy URLs with embedded parameters. For a URL that contains parameters, how is it possible to specify the specific URL in LSApplicationsQueriesSchemes and the openURL using parameters?


For example, assume I have an email app that passes the the senders email address as a parameter:

myapp://com.my.company/mailto?bob@gmail.com


How can parameters be specified using LSApplicationQueriesSchemes whitelist and/or openURL?


The only way it seems to get it to work in iOS9 is to totally remove any parameters.


Any guidance would be appreched.


Dave

Answered by Dave6134 in 38168022

It looks like this issue may have been resolved in iOS9 Beta5. I am now able to launch applications using openURL that have modifiable parameters in the openURL.

This is a new security feature of iOS 9.

Any app built with SDK 9 needs to provide a LSApplicationQueriesSchemes entry in its plist file, declaring which schemes it attempts to query.


<key>LSApplicationQueriesSchemes</key>
<array>
     <string>urlscheme</string>
     <string>urlscheme2</string>
     <string>urlscheme3</string>
     <string>urlscheme4</string>
</array>


As a point of clarification, do not include "://" in the string of a specific app to be whitelisted in the LSApplicationQueriesSchemes array, i.e. "comgooglemaps://". If you do include "://" canOpenUrl: will return NO and provide the "This app is not allowed to query for scheme ***" syslog/error. However, when you make the actual call of canOpenUrl: you must still include the colon i.e. canOpenUrl:@"comgooglemaps:"


Watch WWDC 2015 Session 703 for more information.

And the following article clearly explains what to look out for:

awkwardhare.com/post/121196006730/quick-take-on-ios-9-url-scheme-changes

Max,

Thanks for the response. I understand the new security features in iOS9. Unfortunately, it doesn't address my question.


I am trying to determine how LSApplicationQueriesSchemes provides the ability to pass parameters. For example, the two URL below. What is the correct process for specifying the URL which has an embedded parameter such as email address which will change?


<key>LSApplicationQueriesSchemes</key>

<array>

<string>myapp</string>

<string>myapp://com.mycompany/mailto?bob@gmail.com</string>

<string>myapp://com.mycompany/mailto?jake@gmail.com</string>

</array>


Currently, openURL fails unless the entire URL along with parameters is specified. Since most applications have a URL which provides the ability to pass parameters. What is the process or additional syntax necessary to allow passing such parmeters? Is there any additional syntax which allows for wildcards in the URL specifrication?

such as "myapp://com.mycompany/mailto?*" ?


Dave

Hi Dave,


I better understand your question now - and can see that I should have read it more closely.

I don't, however, have the answer - hopefully someone more knowledgeable can chime in...


Max.

Accepted Answer

It looks like this issue may have been resolved in iOS9 Beta5. I am now able to launch applications using openURL that have modifiable parameters in the openURL.

Passing URL parameters with LSApplicationQueriesSchemes
 
 
Q