Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6609] canOpenURL() always returns the same value

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsios
ReporterLee Debnam
AssigneeAbir Mukherjee
Created2020-09-28T11:12:41.000+0000
Updated2020-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?

Comments

  1. Lee Debnam 2020-09-28

    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.

JSON Source