0

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.0GA).

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?

4

0 回答 0