是否可以从UIWebView中的页面启动iTunes?

时间:2012-07-25 21:58:57

标签: ios uiwebview

我正试图让iTunes从UIWebView中加载的html页面启动。

使用Apple文档中的示例

http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/iTunesLinks.html#//apple_ref/doc/uid/TP40007896-SW1

 <a
 href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441">
 <img height="15" width="61" alt="Randy Newman - Toy Story
- You&#39;ve Got a Friend In Me" src="http://ax.phobos.apple.com.edgesuite.net/images/
 badgeitunes61x15dark.gif"></img> </a>

当我点击按钮时,didFailLoadWithError:将被WebKitErrorDomain 101调用。

shouldStartLoadWithRequest:对任何请求都返回YES)

浏览器中加载的相同html页面正常工作。


(该代码实际上存在另一个问题,请参阅此链接 Remote image doesn't get displayed in html page displayed in UIWebView

但是在将其更改为此之后,它仍然无法在UIWebView中运行,但在浏览器中运行

  <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441">
      <img height="15" width="61" src="Btn_Go.png""></img>
  </a>

1 个答案:

答案 0 :(得分:0)

您可以在this question找到您想要的内容。

答案使用-webView:shouldStartLoadWithRequest:navigationType和点击链接的网址方案来确定系统或网络视图中是否应该打开链接。

它还会处理您提到的错误。 (但只是忽略它..)