iositunes-app

Apple itunes app link opens in UIWebView rather than App Store


I feel like I'm going a little crazy. Everything I see on deep links and opening up app store links tells me this should be working, but it's not.

Our App is basically a wrapper around the UIWebView, with most of the functionality residing in our webpage. I'm wanting to link to the App Store from our website and have it pull it up. If I do it from external browser or anything else, it seems to work. When I do it from a link on our webview, I get the App Store Preview in our WebView. Not helpful.

Here's the link in our HTML:

<td style="width: 50%; padding: 5px"><a href="https://itunes.apple.com/us/app/ab-classic/id343200656?mt=8"><img style="width: 100%" src="~/App_Themes/common/images/mobile/AppStoreBadges/apple-app-store.png" /></a>

Looks like they've done away the old itms: deep linking in favor of the universal links. I could intercept the WebView redirect to their site, and then kick it out from a Swift standpoint, but I wanted this to work on my current code and not make a change just to handle itunes links.


Solution

  • You need a navigation delegate. For UIWebView, your delegate would implement webView(_:shouldStartLoadWith:navigationType:). When you get this link, you would return false and instead pass it open to the runtime with open(_:options:completionHandler:).