RexOnRoids
RexOnRoids

Reputation: 14040

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

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>

Upvotes: 3

Views: 2855

Answers (2)

zszen
zszen

Reputation: 1468

use code:

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

Upvotes: 0

Jeff Kelley
Jeff Kelley

Reputation: 19071

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];

Upvotes: 4

Related Questions