Linking to an app

Discussion in 'iOS Programming' started by drf1229, Sep 26, 2009.

  1. drf1229 macrumors regular

    drf1229

    Joined:
    Jun 22, 2009
    #1
    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"]];
    }
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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).
     
  3. drivefast macrumors regular

    Joined:
    Mar 13, 2008
    #3
    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.
     
  4. boapps macrumors newbie

    Joined:
    Jun 17, 2009
    #4
    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.
     
  5. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #5
    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.
     
  6. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #6
    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
    
     
  7. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #7
    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.
     
  8. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #8

    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)?
     
  9. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #9
    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?
     
  10. North Bronson macrumors 6502

    Joined:
    Oct 31, 2007
    Location:
    San José
    #10
    Code:
    http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=[. . .]
    Always seemed to do the trick for me.
     
  11. drf1229 thread starter macrumors regular

    drf1229

    Joined:
    Jun 22, 2009
    #11
    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.
     
  12. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #12
    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.
     
  13. drf1229 thread starter macrumors regular

    drf1229

    Joined:
    Jun 22, 2009
  14. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #14
    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.
     

Share This Page