I know it\'s possible to link directly to an app in iOS by registering a custom scheme (e.g. so://) and it\'s also possible to link to the app in the appstore via itunes.
There are few simple steps to achieve this Action
Step 1
Go -> Project (select target) -> info -> URL Types
Create URL Scheme in Xcode Like this
here URL Scheme is myApp (it is better to have all character in lowercase).
Step 2
Setup Delegate if you have plan to receive parameters/Query strings from URL
Here is the code :
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary *)options {
NSLog(@"APP : simple action %@",url.scheme);
if ([url.scheme hasPrefix:@"myapp"]) {
NSLog(@"APP inside simple %@",url.absoluteString);
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:url
resolvingAgainstBaseURL:NO];
NSArray *queryItems = urlComponents.queryItems;
NSString * abc = [self valueForKey:@"abc"
fromQueryItems:queryItems];
NSString * xyz = [self valueForKey:@"xyz"
fromQueryItems:queryItems];
NSLog(@"Sid up = %@", abc);
NSLog(@"PID up = %@", xyz);
// you can do anything you want to do here
return YES;
}
return NO;
}
End of Xcode side Work.
Step 3
Referring @BananaNeil Code here as i am not Front end guy
(function() {
var app = {
launchApp: function() {
window.location.replace("myApp://share?abc=12&xyz=123");
this.timer = setTimeout(this.openWebApp, 1000);
},
openWebApp: function() {
window.location.replace("http://itunesstorelink/");
}
};
app.launchApp();
})();
Hope it will HELP you all