Mac App Store is accessed using
macappstore URL scheme. Your URL should follow this pattern:
[APP_ID] with your app’s track id.
You can easily get track ID from URL of the application at App Store. For example, URL of Mac App Store page for Jump Desktop is
? is the required ID which in this case is
Lets test it. Replace
524141863 in the
macappstore:// URL given above. Then open the URL from Terminal
This should open Mac App Store desktop application to Jump Desktop page.
Now that we know the required URL scheme and track ID, opening iTunes page in Mac App Store is pretty simple. See the following code snippet.
1 2 3 4 5 6 7 8
NSString *track_id = @"524141863"; NSString *app_url_str = [NSString stringWithFormat: @"macappstore://itunes.apple.com/app/id%@?mt=12", track_id]; // Create NSURL to pass it to NSWorkspace NSURL *app_url = [NSURL URLWithString:app_url_str]; // Open URL [[NSWorkspace sharedWorkspace] openURL:app_url];
You just need to the pass
openURL: message with correctly formed URL to
[NSWorkspace sharedWorkspace] object.
So what do you think? Did I miss something? Is any part unclear?
Leave your comments below.
You need a free Github account to comment.