Skip to content

Instantly share code, notes, and snippets.

@drewlarsen
Created February 1, 2018 15:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
How to Open SugarWOD from another iOS App
// Sample code to open the SugarWOD iOS app from another app
// will attempt to open the app,
// if app is not installed,
// will re-direct to the SugarWOD page in the app store or in Safari
// SugarWOD URL Scheme
NSURL *url = [NSURL URLWithString:@"sugarwod://"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
// open sugarwod app
[[UIApplication sharedApplication] openURL:url];
} else {
// open in app store
NSURL *url = [NSURL URLWithString:@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=665516348"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
// open in iTunes app
[[UIApplication sharedApplication] openURL:url];
} else {
// open in Safari
url = [NSURL URLWithString:@"http://itunes.com/app/sugarwod"];
[[UIApplication sharedApplication] openURL:url];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment