Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically open Mac App Store

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?

like image 692
David Avatar asked Apr 13 '11 23:04

David


2 Answers

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/"]];
like image 127
Regexident Avatar answered Nov 16 '22 13:11

Regexident


If you just want to show the updates page you can use this URL: macappstore://showUpdatesPage

like image 21
Yoav Avatar answered Nov 16 '22 12:11

Yoav