以编程方式打开Mac App Store [英] Programmatically open Mac App Store

查看:257
本文介绍了以编程方式打开Mac App Store的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图在自定义Mac应用程序中以编程方式打开Mac App Store。我从下面的链接开始。

  http://itunes.apple.com/us/app/angry-birds/id403961173?mt=12 

我试过下面的代码,但它打开浏览器而不是Mac App Store。

  [[NSWorkspace sharedWorkspace] openURL:
[NSURL URLWithString:@http://itunes.apple.com/us/app/angry -birds / id403961173?mt = 12]];有关如何做到这一点的任何建议吗?


=

h2_lin>解决方案

此模式的网址打开Mac App Store:

  macappstore: //itunes.apple.com/app/id403961173?mt=12 

在您的情况下:

  [[NSWorkspace sharedWorkspace] openURL:
[NSURL URLWithString:@macappstore://itunes.apple.com/ app / id403961173?mt = 12]];

将打开MAS并加载与id#403961173(此处为:Angry Birds)相关联的产品页面。



要加载MAS,没有特定的产品页面使用此URL:

  [[NSWorkspace sharedWorkspace] openURL:
[NSURL URLWithString:@macappstore://itunes.apple.com/]];


I am trying to programmatically open the Mac App Store in a custom Mac App. I started with the link below.

http://itunes.apple.com/us/app/angry-birds/id403961173?mt=12

I tried the following code, however it opens the browser rather than the Mac App Store.

[[NSWorkspace sharedWorkspace] openURL:
 [NSURL URLWithString:@"http://itunes.apple.com/us/app/angry-birds/id403961173?mt=12"]];

Any suggestions on how I can do this?

解决方案

URLs of this pattern open up the Mac App Store:

macappstore://itunes.apple.com/app/id403961173?mt=12

So in your case:

[[NSWorkspace sharedWorkspace] openURL:
 [NSURL URLWithString:@"macappstore://itunes.apple.com/app/id403961173?mt=12"]];

will open the MAS and load the product page associated with id #403961173 (here: Angry Birds).

To just load the MAS, with no particular product page use this URL:

[[NSWorkspace sharedWorkspace] openURL:
 [NSURL URLWithString:@"macappstore://itunes.apple.com/"]];

这篇关于以编程方式打开Mac App Store的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆