Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On the iPhone, how can you cause a URL to display an entry in the App Store?

For instance, if someone views a URL for an app on the iPhone, we would like the URL to open the App Store and display the entry related to that app. The idea is to allow downloading of an app with two clicks (click on link, then click on "Install" button) on the iPhone.

How is this possible?

[Edit] To clarify, from within the iPhone app, how can we automatically launch the right entry in the App Store? I understand that mobile Safari recognizes iTunes URL, but we prefer launching the App Store without redirecting to mobile Safari first.

like image 626
Crashalot Avatar asked Oct 01 '10 00:10

Crashalot


2 Answers

EDITED for a better answer:

There's a specific url type for the App Store. Using it will prevent Safari and iTunes from popping up first. The App Store link is:

itms-apps://

As an example, you could do this in response to the user tapping a button (or whatever action):

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"itms-apps://yourAppLinkHere"]];

You can get the correct app link from the iTunes Link Maker at http://itunes.apple.com/linkmaker

In the case of one of my apps, it would look like this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"itms-apps://itunes.apple.com/us/app/its-on-my-way/id334996949?mt=8&uo=4"]];
like image 57
Matthew Frederick Avatar answered Oct 16 '22 23:10

Matthew Frederick


App Store uses the following url format for apps:

http://itunes.com/app/your-app-name

so you can use the following code to open the url:

- (void) buyButtonPressed{
    NSURL *url = [NSURL URLWithString:@"http://itunes.com/app/your-app-name"];
    [[UIApplication sharedApplication] openURL:url];    
}
like image 36
Mihir Mathuria Avatar answered Oct 17 '22 01:10

Mihir Mathuria