views:

3697

answers:

7

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?

+7  A: 

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.

Ben Gottlieb
I've done that. And it doesn't work on 2.1 firmware. You get an "invalid url" error.
Jeff
Works fine for me; in our Crosswords Light app, we link to our full version using this line of code: [UIApp openURL: [NSURL URLWithString: @"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284036524I just tried this on a 2.1 2G iPhone, worked fine.
Ben Gottlieb
I just tested it in the debugger with my actual app plugged in and it's working. Now I'm realizing there is no "AppStore" app on the simulator. Doh. Thanks for the help!
Jeff
Possibly related question: http://stackoverflow.com/questions/818973/819064#819064which gives you much nicer URLs
Roger Nolan
+4  A: 

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.

Marco
+1  A: 

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.

Jamey McElveen
+2  A: 

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.

matt
+3  A: 

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]];
}
epatel
A: 

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 #.

Annette
+1  A: 

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

jeksys