Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

drf1229

macrumors regular
Original poster
Jun 22, 2009
237
0
I'm making a lite version of my ipod app and I'm trying to make a button that says "Click here to download the full version" that links to my app in the app store, but I can't seem to figure out how. I know how to open a link in safari but that's about it. I can't seem to find the right documentation for it. Can somebody please help?

Here's what I have:

Code:
-(IBAction)link{

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.itunes.com/apps/zapball"]];
}
 
I'm not sure if there is a more direct way. Does that not work? I would guess it opens Safari which then opens iTunes. Apple *might* check specifically for iTS URLs like they do for YouTube, but if not I think there's not much you can do besides testing with the direct URL that iTunes gives you (http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=xxx).
 
also, check the terms and conditions, or prepare to get a rejection if caught. i remember apple specifically said they would not allow the practice of linking to another one of your apps - but they may not really enforce that.
 
Try it on a device. I think the simulator has problems with "too many redirects". You can also get more involved and handle the http redirects yourself in code.
 
I think one of the pages it redirects to is mostly all JavaScript, so you could use an internal UIWebView to catch the redirects and then open the final iTS URL yourself.
 
I have had success with URLs in the form - note the itms prefix (is there one for app store?)

Code:
itms://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=xxxxxx
 
I think the simulator has problems with "too many redirects".
The reason for the Simulator's "too many redirects" error is that there is no App Store on it and so it considers that step of bringing up the App Store as the one redirect that broke the camel's back.
 
is there one for app store?
Google suggested that a URL prefix of itms-apps:// goes straight to the app store. Got this from some sites showing how to direct link to app reviews.
Code:
[COLOR=black]itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=xxxxxx[/COLOR]
Can anyone confirm if this works (from a device)?
 
Code:
[COLOR=black]itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=xxxxxx[/COLOR]
Can anyone confirm if this works (from a device)?

Nice, it works (3.1, 7C144). I guess I'd be hesitant in using this in an app, but the chances of them changing the URL scheme is slim to none. Searching Apple's developer site for "itms-apps" brings up nothing, so it seems to be private.

Does anyone know if Apple uses this URL scheme outside of the http redirects?
 
Thank you so much for your responses! I didn't test the link on my ipod yet but I be sure to try it out. I'm not sure about not being able to link to your app due to restrictions from itunes connect because I've seen a lite app that links to the full version.
 
it may simply be undocumented, so they may not reject your app if this is used. emailing them to ask couldn't hurt. maybe post the question to the apple developer forum beta since there are several apple employees responding to posts. if you do use this, just make sure to only supply an active link after testing to see if the device is connected to the internet.
 
i recently downloaded a free game from the app store called "Racers" (or something like that... the demo version) and the developer had a link to his paid version which opened up the app store on the device, so it appears that this is allowed.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.