kosso / TiGram

Module for sharing a photo with caption from Titanium to the Instagram app, if installed.
Other
11 stars 3 forks source link

tigram.isInstalled returns false, even when instagram is installed #2

Open arifje opened 8 years ago

arifje commented 8 years ago

Ti SDK 5.0.0 iOS 9.0

    // try open
    if (tigram.isInstalled) {
        tigram.openPhoto({
            media: screenshot.toBlob(),
            caption: caption
        });
    } else {
        alert("Instagram is not installed!");
    }   
kosso commented 8 years ago

The module uses a very simple method to determine if Instagram is installed. It's possible that Apple have changed this, due to reports I read about other apps using this method to determine what other apps were installed on a device, without asking permission to do so.

Try using the Titanium method Ti.Platform.canOpenURL to see if the app can open the url: "instagram://app" - If so, it should be installed. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Platform-method-canOpenURL

So, if this isn't working, either Apple have changed the availability of canOpenURL, or the instagram app has changed its bundle url.