Support URL
Open an external App using a custom Url
var url = "app_scheme://message"
App.openURL(url)
The canOpenURL(url)
method returns true
if the scheme of the url parameter is listed in the LSApplicationQueriesSchemes
value of the Properties list, false
otherwise.
The openURL(url)
method tries to open the url even if the scheme is not listed in the LSApplicationQueriesSchemes
value.
How to add schemes to LSApplicationQueriesSchemes
- Open the Properties window from the menu Project.
- Add an item to the root
Property List
dictionary, if not already existing, with nameLSApplicationQueriesSchemes
and typeArray
. - Add a string item for each scheme that the app is able to test using the
canOpenURL(url)
method.
Project
- open-url-opener.creoproject (12KB)
Process custom Urls sent by external Apps
- Select the App object inside the layout area
- Write your custom code in the
OpenUrl(url, options)
event, for example:
if (url.contains("message1")) {
// process the message1 case
return true
}
if (url.contains("message2")) {
// process the message2 case
return true
}
return false
How to configure custom schemes
- Open the Properties window from the menu Project.
- Add an item to the root
Property List
dictionary, if not already existing, with nameCFBundleURLTypes
and and typeArray
. - Add an dictionary item for each URL scheme supported by the app, this dictionary must contain the following key/value pair:
CFBundleURLName
: aString
value that represents the abstract name for this URL type. This is the main way to refer to a particular type. The value must be unique.CFBundleURLSchemes
: anArray
ofString
s, each of which identifies a URL scheme handled by this type.
Project
- open-url.creoproject (10KB)