Amitg2k12
Amitg2k12

Reputation: 3805

iOS App URL Scheme launch application or open app store

In iOS App, to launch an application from safari, the URL scheme is something like this, Launch App from URL
is it possible to re-direct URL to Appstore pointing to the App if the particular app is not installed in the device,
Basically what i am looking

there are examples of how to link to app to app store, but not able to add condition in the js when to launch custom URL scheme if app is there, else launch app store.

Update :

the answer provided and in the comment take me to the page which says how to launch the app store with specific app that's secdonary requirement, initially i need to have some js code which can detect whether the device has an app specific to URL scheme if not then open the App Store app page

element

Upvotes: 1

Views: 5847

Answers (1)

Miralem Cebic
Miralem Cebic

Reputation: 1286

I'm not sure if you can check if a third party app is installed on your device by code. I think only when you know the url-scheme of this specific 3rd party app you can check by

BOOL canOpen = NO;
    canOpen = [[UIApplication sharedApplication] canOpenURL:url];
    if (canOpen) {
        [[UIApplication sharedApplication] openURL:url];
    } else {
[[UIApplication sharedApplication] openURL:@"itms://itunes.apple.com/us/app/mensa-essen/id742570910?ls=1&mt=8"]; }

Upvotes: 4

Related Questions