[AC-6609] canOpenURL() always returns the same value
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | ios |
Reporter | Lee Debnam |
Assignee | Abir Mukherjee |
Created | 2020-09-28T11:12:41.000+0000 |
Updated | 2020-09-28T16:13:12.000+0000 |
Description
I am trying to test for the presence of another app installed on a device on iOS using the latest version of Titanium (currently
9.2.0.GA
).
For some reason the function canOpenURL()
always returns the same value regardless of whether the app is installed or not.
My code is as follows:
var strUrl = "whatsapp://";
if (Titanium.Platform.canOpenURL(strUrl)) {
Ti.API.info("can open whatsapp");
Ti.Platform.openURL(strUrl);
} else {
Ti.API.info("can't open whatsapp");
Ti.Platform.openURL("itms://itunes.apple.com/app/apple-store/idXXXXXXXX?mt=8");
}
If I list WhatsApp in my CFBundleURLSchemes
the function always returns true whether I have the app installed or not. If it is not listed it always returns false. I have also tried capturing the value from Ti.Platform.openURL()
which seems to do the same.
Any idea what I am missing?
If I ditch the CFBundleScheme (I realise here I'm calling this app whatsapp) and list whatsapp in the LSApplicationQueriesSchemes then the function always returns false.