I'm creating an application where users can share data by sending emails to each other. In this mail there is a link to my app (I created an URL scheme for my app) But, if the users doesn't have my application on his iPhone, then when he clicks on the link, nothing happens.
My question : How could I do to launch my app when the application is installed on the user's iPhone and launch the Appstore or a website if this application is not installed
Thank you
canOpenURL
is what you're looking for.
Here is an example for launching twitter app:
NSURL* twitterURL = [NSURL URLWithString:[NSString stringWithFormat:@"twitter:@%@", twitterUser]];
if ([[UIApplication sharedApplication] canOpenURL:twitterURL]) {
[[UIApplication sharedApplication] openURL:twitterURL];
} else {
NSURL* url = [NSURL URLWithString:@"http://itunes.apple.com/us/app/twitter/id333903271?mt=8"];
[[UIApplication sharedApplication] openURL:url];
}
EDIT
If you want do do this from a webpage or html email, you find your answer here: https://stackoverflow.com/a/627942/550177
and here: https://stackoverflow.com/a/1109200/550177
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With