Question

I've used several apps now that launch the itunes store directly from the app. I'm even using some on my 2.1 iPod 2G.

I know there's a bug in 2.1 that prevents appstore links from working in safari, but somehow people are launching the appstore directly, not even through safari.

How do you do this? Is it an undocumented openURL feature?

Was it helpful?

Solution

From iTunes, drag the icon of your app to the desktop, this will give you a link you can use directly (for example, http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284036524&mt=8 launches the AppStore to Crosswords, both on a desktop and an iPhone).

Pop this into an NSURL and call openURL on it.

OTHER TIPS

To be extremely concise:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/appname"]];

If you want to send to all the apps for a developer, use

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/developername"]];

These work for iOS 4.1

See Also How to link to apps on the app store

I figured out how to get straight into the review page for an app in the AppStore.

Basically it's done like below, feel free to read my blog post about it.

- (IBAction)gotoReviews:(id)sender
{
    NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
    str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str]; 
    str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];

    // Here is the app id from itunesconnect
    str = [NSString stringWithFormat:@"%@289382458", str]; 

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}

If you want to show the details of the application instead of the reviews, you can use the url like this:

NSString *appId    = @"app id";
NSString *endPoint = [NSString stringWithFormat:@"phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%@&mt=8", appId];
NSString *link     = [NSString stringWithFormat:@"itms-apps://%@", endPoint];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:link]];

I've tested this on my iPhone with iOS 6.1 and will redirect you to the App Store app immediately.

Ben Gottlieb is right, but there's a faster way to get the URL: You can right-click on any application icon in iTunes and select "Copy iTunes Store URL".

Then call UIApplication openURL on it.

Make sure it says "phobos.apple.com" and not "itunes.apple.com"

The former opens the App Store directly, while the latter will open MobileSafari first, then the App Store.

You can get your AppID from the itunesconnect.apple.com "Manage Your Applications"

If you do not want to get the link for iTunes you can do this.

  1. select your app in AppStore
  2. click the Tell A Friend button in the top right.
  3. email the link to yourself

I have had this work at time the iTunes link would not.

If you have an affiliate link and you would like to still open App Store app directly without Safari in the middle, you could use a hidden UIWebView or an NSURLConnection. For the latter see this post http://gamesfromwithin.com/handling-app-store-and-linkshare-links

Here is the code I use and tested it against the various iOS versions mentioned. Obviously change the customer id to be your one:

- (void)showOurAppsInAppStore
{        
    NSString *searchUrl = nil;
    // iPad
    if ([DeviceController isDeviceAnIpad]) {
        searchUrl = @"itms-apps://itunes.apple.com/us/artist/seligman-ventures-ltd/id326161338";
    }
    // iPhone / iPod Touch
    else {
        // iOS 7+
        if ([DeviceController isDeviceOperatingSystemAtleast:@"7.0"]) {
            searchUrl = @"itms-apps://itunes.apple.com/artist/seligman-ventures-ltd/id326161338";
        }
        // iOS 6
        else if ([DeviceController isDeviceOperatingSystemAtleast:@"6.0"]) {
            searchUrl = @"itms-apps://ax.itunes.apple.com/artist/seligman-ventures-ltd/id326161338";
        }
        // Pre iOS 6
        else {
            NSString *companyName = @"Seligman Ventures";
            searchUrl = [NSString stringWithFormat:@"http://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?WOURLEncoding=ISO8859_1&lang=1&output=lm&country=US&term=%@&media=software", [companyName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
        }
    }

    [[UIApplication sharedApplication] openURL: [NSURL URLWithString:searchUrl]];
}

If you are just releasing your app... you won't have an "app ID #" yet... so none of those methods will work.

I had to insert a "non-working link" in my v1.0... and then later in my v1.1 update... added the actual link and app ID #.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top