How can I jump to the App Store from a UIWebView link in my iPhone app?

2.8k Views Asked by At

I want to take a user OUT of my app and into the App Store when they click on a link within a UIWebView in my app. But when I click on the link, nothing happens (sim AND device both). How can I jump to the App Store from a UIWebView link in my iPhone app?

BY THE WAY:
The link in my UIWebView html is as currently follows (minus the self-promotion)

<a href="http://itunes.apple.com/jp/app/someappname/someidnum?mt=8">Download Now</a>
2

There are 2 best solutions below

0
Jeff Kelley On BEST ANSWER

Hmm. Perhaps you’re right. In that case, simply use this function of the UIWebViewDelegate:

- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
 navigationType:(UIWebViewNavigationType)navigationType

Parse the NSURLRequest to see if it’s an iTunes link and if it is, do this:

[[UIApplication sharedApplication] openURL:someURL];
0
zszen On

use code:

[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://itunes.apple.com/xxxxx"]];