761

I am creating a free version of my iPhone game. I want to have a button inside the free version that takes people to the paid version in the app store. If I use a standard link

http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300136119&mt=8

the iPhone opens Safari first, and then the app store. I have used other apps that open the app store directly, so I know it is possible.

Any ideas? What is the URL Scheme for the app store?

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
matt
  • 1,895
  • 5
  • 19
  • 26

27 Answers27

817

Edited on 2016-02-02

Starting from iOS 6 SKStoreProductViewController class was introduced. You can link an app without leaving your app. Code snippet in Swift 3.x/2.x and Objective-C is here.

A SKStoreProductViewController object presents a store that allows the user to purchase other media from the App Store. For example, your app might display the store to allow the user to purchase another app.


From News and Announcement For Apple Developers.

Drive Customers Directly to Your App on the App Store with iTunes Links With iTunes links you can provide your customers with an easy way to access your apps on the App Store directly from your website or marketing campaigns. Creating an iTunes link is simple and can be made to direct customers to either a single app, all your apps, or to a specific app with your company name specified.

To send customers to a specific application: http://itunes.com/apps/appname

To send customers to a list of apps you have on the App Store: http://itunes.com/apps/developername

To send customers to a specific app with your company name included in the URL: http://itunes.com/apps/developername/appname


Additional notes:

You can replace http:// with itms:// or itms-apps:// to avoid redirects.

Please note that itms:// will send the user to the iTunes store and itms-apps:// with send them to the App Store!

For info on naming, see Apple QA1633:

https://developer.apple.com/library/content/qa/qa1633/_index.html.

Edit (as of January 2015):

itunes.com/apps links should be updated to appstore.com/apps. See QA1633 above, which has been updated. A new QA1629 suggests these steps and code for launching the store from an app:

  1. Launch iTunes on your computer.
  2. Search for the item you want to link to.
  3. Right-click or control-click on the item's name in iTunes, then choose "Copy iTunes Store URL" from the pop-up menu.
  4. In your application, create an NSURL object with the copied iTunes URL, then pass this object to UIApplication' s openURL: method to open your item in the App Store.

Sample code:

NSString *iTunesLink = @"itms://itunes.apple.com/app/apple-store/id375380948?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];

iOS10+:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink] options:@{} completionHandler:nil];

Swift 4.2

   let urlStr = "itms-apps://itunes.apple.com/app/apple-store/id375380948?mt=8"
    if #available(iOS 10.0, *) {
        UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
        
    } else {
        UIApplication.shared.openURL(URL(string: urlStr)!)
    }
GeneCode
  • 7,545
  • 8
  • 50
  • 85
Nathan S.
  • 5,244
  • 3
  • 45
  • 55
  • 164
    A tip is to use itms:// instead of http://, then it'll open in the app store directly. On the iPhone, it will make 2 (!) redirects when using http, and 1 when using itms. When using the older phobos links (see above), there are 0 redirects. Use the id from iTunes Connect if using phobos links. You can choose to submit an app without including the binary. This way you will get the id before you submit the actual binary. I haven't tried this, but I've heard it works. – quano Mar 14 '10 at 01:59
  • 1
    Is there a way to link like this and still maintain affiliate status? – radven Dec 21 '10 at 00:57
  • 1
    I'm not sure. You might want to ask this as a separate question, as you are likely to get more answers that way. – Nathan S. Dec 21 '10 at 19:06
  • What if your app name contains spaces? Would that be replaced by underscores in the link? – Boon Apr 18 '11 at 02:08
  • 11
    See: http://developer.apple.com/library/ios/#qa/qa1633/_index.html (White space should just be removed.) – Nathan S. Apr 18 '11 at 02:53
  • The link in this post is broken; the content looks like it came from a news snippet posted on 1/6/2010. Nathan S. has a better link. – Adam Rosenfield Sep 16 '11 at 20:48
  • 10
    Except...what is the correct value to use for `appname`? Is it the app's "Bundle Display Name"? Is it case-insensitive? How are blank spaces handled, etc.? – aroth Sep 23 '11 at 00:51
  • @aroth, the correct name for appname is the name that you have given (or intend to do so) in iTunesConnect when uploading the app for the first time. Therefore you may not be able to test the link before the app is finally in the store. To overcome that I used a link to my app home page from where I lead via link to the store (and provided other information of course). With the first update of my app I linked directly to the store. – Hermann Klecker Feb 06 '12 at 17:04
  • 16
    This should be tested on a real device. – Protocole Feb 07 '12 at 09:31
  • @quano Using the full itunes.apple.com URL with http (instead of itunes.com) also opens the app store directly. – Andrew Hershberger Mar 28 '12 at 15:00
  • @AndrewHershberger But what quano is saying is that using itms reduces the number of redirects, therefore making it a better experience for the user. – Flipper Jul 05 '12 at 18:54
  • 8
    This SHOULD be tested on a real device, yes! I struggled with nothing happening for about an hour before plugging the iPad in and testing it there. Geh. – Kalle Aug 16 '12 at 18:42
  • @bagusflyer See the link to QA1633, it has all the necessary details on naming. – Nathan S. Sep 14 '12 at 16:38
  • 1
    @GMsoF, this was long ago, and I'm not sure whether or not the redirects still apply. Anyway, you can find a phobos link below. http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300136119&mt=8 . Simply change the id to your app id. – quano Mar 07 '13 at 12:02
  • Google shows the link "Will be visible at..." when uploading to Google Play. And the reason Apple doesn't show this link when uploading is...? >:( It's left to the insecurity of googling news, blog and forum posts that could be old and invalid. At least Nathan S. is helpful, so +1 for that! – Henrik Erlandsson May 23 '13 at 13:57
  • http://itunes.com/apps/developername is not working for me.Can we open and show all the apps uploaded by the developer in one page? – Imran Mar 12 '14 at 10:55
  • @Imran I assume you're replacing "developername" with your developer name? See the linked QA1633 for information about how to get the proper developer name. – Nathan S. Mar 12 '14 at 15:28
  • Thanks Nathan but I am unable to get it.Can you please tell me whether this functionality is working in the latest update. – Imran Mar 13 '14 at 07:00
  • suppose my developer name is Imran then I am passing...http://appstore.com/imran...So this is valid one but its not working. – Imran Mar 13 '14 at 07:13
  • @Imran I suggest asking this in a separate question, linking back to this question for reference. – Nathan S. Mar 14 '14 at 20:42
  • My app name has spaces. How do I put my app name at the end of the link ?? @HermannKlecker – WowBow Jun 12 '14 at 12:27
  • @WowBow See the comment above -- white spaces are removed. – Nathan S. Jun 12 '14 at 14:26
  • 1
    Is it acceptable to use the app's ID only, e.g. itms-apps://itunes.apple.com/app/id123456789?mt=8 The link generator uses the 'app store name', which I plan to change on the next update, but it's not set yet... – Gavin Hope Oct 15 '14 at 07:24
  • I recommend using the path with developername preceding the appname; that way if your app name changes the user will still be taken to the list of developer apps. – avance Dec 18 '14 at 23:08
  • tried the update on the simulator and I get an error in the browser page "address invalid" – Laur Stefan Mar 03 '15 at 01:30
  • 4
    If you use itms: It will not show you the option to update if there is an update available. Use itms-apps:// or https:// instead. – Zaartha Jan 11 '16 at 11:42
  • To search the link, Apple has now an interface much better and easier: https://linkmaker.itunes.apple.com/ – Soldeplata Saketos Jul 23 '16 at 09:22
  • 2
    On iOS. `itms` opens itunes. while `itms-apps` opens the App Store. This is a key difference if prompting users to update! (iOS 10) – mcm Dec 16 '16 at 22:49
  • Code snippets in [Swift and objective-c](http://stackoverflow.com/a/32008404/1151916) – Ramis Jan 23 '17 at 14:44
  • 4
    The highly-rated comment says to use `itms://`... but that opens the iTunes app, not the App Store app! Use `itms-apps://` instead. – pkamb Mar 03 '17 at 23:07
  • 1
    Note that any links given here do not work in the simulator (iOS 11 beta3), but works on the device (iOS 10.3). – Altimac Jul 25 '17 at 15:56
  • Currently (iOS 11) to open the developer's page you need to use a link similar to this one: itms-apps://itunes.apple.com/developer/johndoe/id123456789 – Leszek Szary May 04 '18 at 20:56
  • 1
    Note that `SKStoreProductViewController` is extremely slow on iOS 12 devices. It sometimes takes over 10 seconds for me to load the product page, so I wouldn't recommend using that class on iOS 12 to avoid losing all the impatient users. (see https://forums.developer.apple.com/thread/107618) – Theo Nov 13 '18 at 11:08
  • how to open in App Store instead of iTunes Store? Also it's better not include `us` in the link. – user924 May 12 '19 at 21:57
  • and iTunes Store app can be deleted by a user – user924 May 12 '19 at 21:59
  • please also see `https://tools.applemediaservices.com/app-store/` – rwcorbett Mar 16 '22 at 20:52
371

If you want to open an app directly to the App Store, you should use:

itms-apps://...

This way it will directly open the App Store app in the device, instead of going to iTunes first, then only open the App Store (when using just itms://)


EDIT: APR, 2017. itms-apps:// actually works again in iOS10. I tested it.

EDIT: APR, 2013. This no longer works in iOS5 and above. Just use

https://itunes.apple.com/app/id378458261

and there are no more redirects.

starball
  • 20,030
  • 7
  • 43
  • 238
GeneCode
  • 7,545
  • 8
  • 50
  • 85
  • I don't think this is necessary any longer. I use http in my app and it goes straight to the App Store app. – PEZ Jan 17 '11 at 19:55
  • 2
    @PEZ As of today, I'm seeing two redirects when using http://... The answer works perfectly for me - itms-apps://... directly opens the App Store app on device, without any redirects. – Josh Brown Feb 03 '11 at 07:20
  • I admit, i didn't trace the requests. =) I'll change to imts-apps too now. – PEZ Feb 03 '11 at 09:04
  • helps a bunch, thanks. fwiw, using just "itms:" on ipad2/ios 4 i get a redirect, and with "itms-apps:" i don't. – orion elenzil Aug 08 '11 at 03:19
  • 4
    Rocotilos, are you sure this no longer works? Can you post a link? – johndodo May 19 '13 at 17:33
  • Can we open and show all the apps uploaded by the developer in one page? – Imran Mar 12 '14 at 10:56
  • It does indeed help. I needed this specific answer because we've moved to a universal app. We need to avoid reference to the app name in the url (because it is changing) while pointing the user to the very app that will be replaced by the universal app. – Alyoshak Jun 24 '14 at 14:48
  • 9
    On iOS. `itms` opens itunes. while `itms-apps` opens the App Store. This is a key difference if prompting users to update! (iOS 10) – mcm Dec 16 '16 at 22:40
  • `itms` is valid right now, however, `itms-apps` or `itms-apps` is invalid. For example, `itms-apps://itunes.apple.com/us/app/apple-store/id375380948` is reported as invalid by safari on any iOS 10 device. @mcm – DawnSong Feb 24 '17 at 04:04
  • 2
    `itms-apps` opens the App Store app for me via `openURL:` in iOS 10.2. Seems to be no issue. – pkamb Mar 03 '17 at 23:06
  • 1
    Since 10.3 this method works but it have to pass through an intermediate display popup 'open this URL with app store'? Reference: https://blog.branch.io/the-problem-with-apple-app-store-redirects-on-safari-ios-10-3/ – gabry Jul 20 '17 at 14:48
  • 1
    Thanks for this.. It works like a play store link :) – Ask Xah Mar 09 '19 at 15:01
  • @DawnSong it's not about Safari, it's about app you develop – user924 May 12 '19 at 22:04
  • Basic guidelines https://www.whatmattered.com/publishing-mobile-apps-on-app-store-google-play/ – Fahed Yasin May 24 '22 at 06:16
62

Starting from iOS 6 right way to do it by using SKStoreProductViewController class.

Swift 5.x:

func openStoreProductWithiTunesItemIdentifier(_ identifier: String) {
    let storeViewController = SKStoreProductViewController()
    storeViewController.delegate = self

    let parameters = [ SKStoreProductParameterITunesItemIdentifier : identifier]
    storeViewController.loadProduct(withParameters: parameters) { [weak self] (loaded, error) -> Void in
        if loaded {
            // Parent class of self is UIViewContorller
            self?.present(storeViewController, animated: true, completion: nil)
        }
    }
}
private func productViewControllerDidFinish(viewController: SKStoreProductViewController) {
    viewController.dismiss(animated: true, completion: nil)
}
// Usage:
openStoreProductWithiTunesItemIdentifier("1234567")

Swift 3.x:

func openStoreProductWithiTunesItemIdentifier(identifier: String) {
    let storeViewController = SKStoreProductViewController()
    storeViewController.delegate = self

    let parameters = [ SKStoreProductParameterITunesItemIdentifier : identifier]
    storeViewController.loadProduct(withParameters: parameters) { [weak self] (loaded, error) -> Void in
        if loaded {
            // Parent class of self is UIViewContorller
            self?.present(storeViewController, animated: true, completion: nil)
        }
    }
}

func productViewControllerDidFinish(_ viewController: SKStoreProductViewController) {
    viewController.dismiss(animated: true, completion: nil)
}
// Usage:
openStoreProductWithiTunesItemIdentifier(identifier: "13432")

You can get the app's itunes item identifier like this: (instead of a static one)

Swift 3.2

var appID: String = infoDictionary["CFBundleIdentifier"]
var url = URL(string: "http://itunes.apple.com/lookup?bundleId=\(appID)")
var data = Data(contentsOf: url!)
var lookup = try? JSONSerialization.jsonObject(with: data!, options: []) as? [AnyHashable: Any]
var appITunesItemIdentifier = lookup["results"][0]["trackId"] as? String
openStoreProductViewController(withITunesItemIdentifier: Int(appITunesItemIdentifier!) ?? 0)

Swift 2.x:

func openStoreProductWithiTunesItemIdentifier(identifier: String) {
    let storeViewController = SKStoreProductViewController()
    storeViewController.delegate = self

    let parameters = [ SKStoreProductParameterITunesItemIdentifier : identifier]
    storeViewController.loadProductWithParameters(parameters) { [weak self] (loaded, error) -> Void in
        if loaded {
            // Parent class of self is UIViewContorller
            self?.presentViewController(storeViewController, animated: true, completion: nil)
        }
    }
}

func productViewControllerDidFinish(viewController: SKStoreProductViewController) {
    viewController.dismissViewControllerAnimated(true, completion: nil)
}
// Usage
openStoreProductWithiTunesItemIdentifier("2321354")

objective-C:

static NSInteger const kAppITunesItemIdentifier = 324684580;
[self openStoreProductViewControllerWithITunesItemIdentifier:kAppITunesItemIdentifier];

- (void)openStoreProductViewControllerWithITunesItemIdentifier:(NSInteger)iTunesItemIdentifier {
    SKStoreProductViewController *storeViewController = [[SKStoreProductViewController alloc] init];

    storeViewController.delegate = self;

    NSNumber *identifier = [NSNumber numberWithInteger:iTunesItemIdentifier];

    NSDictionary *parameters = @{ SKStoreProductParameterITunesItemIdentifier:identifier };
    UIViewController *viewController = self.window.rootViewController;
    [storeViewController loadProductWithParameters:parameters
                                   completionBlock:^(BOOL result, NSError *error) {
                                       if (result)
                                           [viewController presentViewController:storeViewController
                                                              animated:YES
                                                            completion:nil];
                                       else NSLog(@"SKStoreProductViewController: %@", error);
                                   }];

    [storeViewController release];
}

#pragma mark - SKStoreProductViewControllerDelegate

- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
    [viewController dismissViewControllerAnimated:YES completion:nil];
}

You can get kAppITunesItemIdentifier (app's itunes item identifier) like this: (instead of a static one)

NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString* appID = infoDictionary[@"CFBundleIdentifier"];
    NSURL* url = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@", appID]];
    NSData* data = [NSData dataWithContentsOfURL:url];
    NSDictionary* lookup = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
    NSString * appITunesItemIdentifier =  lookup[@"results"][0][@"trackId"]; 
    [self openStoreProductViewControllerWithITunesItemIdentifier:[appITunesItemIdentifier intValue]];
user1039695
  • 981
  • 11
  • 20
Ramis
  • 13,985
  • 7
  • 81
  • 100
  • 4
    in swift don't forget to import and delegate: import StoreKit class RateMeViewController: UIViewController, SKStoreProductViewControllerDelegate { – djdance Apr 11 '16 at 21:45
  • This still works, however when you go and click Write a Review, it does not work. You have to click the Store button in the top corner and then click Write a Review. Anyone know a workaround?? – socca1157 May 21 '16 at 18:59
  • "Write a review" tries to open another modal and fails, probably because you're already presenting in modal. But Apple forces it. So seems there is no proper way to make reviews work. rendering this whole concept void. – AmitP Jan 23 '17 at 14:41
  • That json not always returning data and returns count zero sometimes. Not reliable to get app id before submission. – Amber K Feb 04 '19 at 13:06
42

Apple just announced the appstore.com urls.

https://developer.apple.com/library/ios/qa/qa1633/_index.html

There are three types of App Store Short Links, in two forms, one for iOS apps, another for Mac Apps:

Company Name

iOS: http://appstore.com/ for example, http://appstore.com/apple

Mac: http://appstore.com/mac/ for example, http://appstore.com/mac/apple

App Name

iOS: http://appstore.com/ for example, http://appstore.com/keynote

Mac: http://appstore.com/mac/ for example, http://appstore.com/mac/keynote

App by Company

iOS: http://appstore.com// for example, http://appstore.com/apple/keynote

Mac: http://appstore.com/mac// for example, http://appstore.com/mac/apple/keynote

Most companies and apps have a canonical App Store Short Link. This canonical URL is created by changing or removing certain characters (many of which are illegal or have special meaning in a URL (for example, "&")).

To create an App Store Short Link, apply the following rules to your company or app name:

Remove all whitespace

Convert all characters to lower-case

Remove all copyright (©), trademark (™) and registered mark (®) symbols

Replace ampersands ("&") with "and"

Remove most punctuation (See Listing 2 for the set)

Replace accented and other "decorated" characters (ü, å, etc.) with their elemental character (u, a, etc.)

Leave all other characters as-is.

Listing 2 Punctuation characters that must be removed.

!¡"#$%'()*+,-./:;<=>¿?@[]^_`{|}~

Below are some examples to demonstrate the conversion that takes place.

App Store

Company Name examples

Gameloft => http://appstore.com/gameloft

Activision Publishing, Inc. => http://appstore.com/activisionpublishinginc

Chen's Photography & Software => http://appstore.com/chensphotographyandsoftware

App Name examples

Ocarina => http://appstore.com/ocarina

Where’s My Perry? => http://appstore.com/wheresmyperry

Brain Challenge™ => http://appstore.com/brainchallenge

Dev01
  • 13,292
  • 19
  • 70
  • 124
  • 1
    this is actually the only thing that still works reliable for mac store at least – Radu Simionescu Oct 19 '15 at 00:05
  • Good to know about this, but unfortunately on iOS this redirects through Safari (and gives an ugly "Cannot Verify Server Identity" message). – sudo make install Jan 15 '16 at 22:52
  • NO. Read this - "These App Store Short Links are provided as a convenience and are not guaranteed to link to a particular app or company." So basically it is randomly given. – durazno Sep 27 '16 at 07:20
41

For summer 2015 onwards ...

-(IBAction)clickedUpdate
{
    NSString *simple = @"itms-apps://itunes.apple.com/app/id1234567890";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:simple]];
}

replace 'id1234567890' with 'id' and 'your ten digit number'

  1. This works perfectly on all devices.

  2. It does go straight to the app store, no redirects.

  3. Is OK for all national stores.

  4. It's true you should move to using loadProductWithParameters, but if the purpose of the link is to update the app you are actually inside of: it's possibly better to use this "old-fashioned" approach.

Community
  • 1
  • 1
Fattie
  • 27,874
  • 70
  • 431
  • 719
37

To have a direct link without redirection :

  1. Use Apple Services Marketing Tools : https://tools.applemediaservices.com/ to get the real direct link
  2. Replace the https:// with itms-apps://
  3. Open the link with UIApplication.shared.open(url, options: [:])

Be careful, those links only works on actual devices, not in simulator.

Source :

Dulgan
  • 6,674
  • 3
  • 41
  • 46
31

This code generates the App Store link on iOS

NSString *appName = [NSString stringWithString:[[[NSBundle mainBundle] infoDictionary]   objectForKey:@"CFBundleName"]];
NSURL *appStoreURL = [NSURL URLWithString:[NSString stringWithFormat:@"itms-apps://itunes.com/app/%@",[appName stringByReplacingOccurrencesOfString:@" " withString:@""]]];

Replace itms-apps with http on Mac:

NSURL *appStoreURL = [NSURL URLWithString:[NSString stringWithFormat:@"http:/itunes.com/app/%@",[appName stringByReplacingOccurrencesOfString:@" " withString:@""]]]; 

Open URL on iOS:

[[UIApplication sharedApplication] openURL:appStoreURL];

Mac:

[[NSWorkspace sharedWorkspace] openURL:appStoreURL];
Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
Tibidabo
  • 21,461
  • 5
  • 90
  • 86
29

Simply change 'itunes' to 'phobos' in the app link.

http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300136119&mt=8

Now it will open the App Store directly

matt
  • 1,895
  • 5
  • 19
  • 26
19

This worked for me perfectly using only APP ID:

 NSString *urlString = [NSString stringWithFormat:@"http://itunes.apple.com/app/id%@",YOUR_APP_ID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

The number of redirects is ZERO.

Leena
  • 2,678
  • 1
  • 30
  • 43
Almas Adilbek
  • 4,371
  • 10
  • 58
  • 97
13

A number of answers suggest using 'itms' or 'itms-apps' but this practice is not specifically recommended by Apple. They only offer the following way to open the App Store:

Listing 1 Launching the App Store from an iOS application

NSString *iTunesLink = @"https://itunes.apple.com/us/app/apple-store/id375380948?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];

See https://developer.apple.com/library/ios/qa/qa1629/_index.html last updated March, 2014 as of this answer.

For apps that support iOS 6 and above, Apple offers a in-app mechanism for presenting the App Store: SKStoreProductViewController

- (void)loadProductWithParameters:(NSDictionary *)parameters completionBlock:(void (^)(BOOL result, NSError *error))block;

// Example:
SKStoreProductViewController* spvc = [[SKStoreProductViewController alloc] init];
spvc.delegate = self;
[spvc loadProductWithParameters:@{ SKStoreProductParameterITunesItemIdentifier : @(364709193) } completionBlock:^(BOOL result, NSError *error){ 
    if (error)
        // Show sorry
    else
        // Present spvc
}];

Note that on iOS6, the completion block may not be called if there are errors. This appears to be a bug that was resolved in iOS 7.

Ben Flynn
  • 18,524
  • 20
  • 97
  • 142
12

You can get a link to a specific item in the app store or iTunes through the link maker at: http://itunes.apple.com/linkmaker/

Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
  • This one help me, because the link in my itunes-connect didn't work, and in the generator it does. thank you – Dorad Nov 06 '15 at 12:10
12

If you want to link to a developer's apps and the developer's name has punctuation or spaces (e.g. Development Company, LLC) form your URL like this:

itms-apps://itunes.com/apps/DevelopmentCompanyLLC

Otherwise it returns "This request cannot be processed" on iOS 4.3.3

Andrew
  • 7,630
  • 3
  • 42
  • 51
  • 1
    If this doesn't work for you, try the following syntax: itms-apps://itunes.com/apps/ChuckSmith/id290402113 replacing my name with your company and my ID with your Artist ID which you can get from the iTunes link maker: http://itunes.apple.com/linkmaker/ – Chuck Smith Jan 10 '12 at 12:40
  • You could also try to encode those "special" chars - i.e. replace "." with "%2E" – wzs Mar 07 '12 at 08:50
  • that is THE prefect answer! – Sam B Mar 01 '13 at 23:50
9

All the answers are outdated and don't work; use the below method.

All apps of a developer:
itms-apps://apps.apple.com/developer/developer-name/developerId

Single app:
itms-apps://itunes.apple.com/app/appId

pkamb
  • 33,281
  • 23
  • 160
  • 191
Karen Karapetyan
  • 704
  • 1
  • 9
  • 18
9

This is working and directly linking in ios5

NSString *iTunesLink = @"http://itunes.apple.com/app/baseball-stats-tracker-touch/id490256272?mt=8";  
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
TouchMint
  • 111
  • 3
  • 9
8

This is simple and short way to redirect/link other existing application on app store.

 NSString *customURL = @"http://itunes.apple.com/app/id951386316";

 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]])
 {
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
 } 
Chirag Lukhi
  • 1,528
  • 17
  • 41
7

For Xcode 9.1 and Swift 4:

  1. Import StoreKit:
import StoreKit

2.Conform the protocol

SKStoreProductViewControllerDelegate

3.Implement the protocol

func openStoreProductWithiTunesItemIdentifier(identifier: String) {
    let storeViewController = SKStoreProductViewController()
    storeViewController.delegate = self

    let parameters = [ SKStoreProductParameterITunesItemIdentifier : identifier]
    storeViewController.loadProduct(withParameters: parameters) { [weak self] (loaded, error) -> Void in

        if loaded {
            // Parent class of self is UIViewContorller
            self?.present(storeViewController, animated: true, completion: nil)
        }
    }   
}

3.1

func productViewControllerDidFinish(_ viewController: SKStoreProductViewController) {
    viewController.dismiss(animated: true, completion: nil)
}
  1. How to use:
openStoreProductWithiTunesItemIdentifier(identifier: "here_put_your_App_id")

Note:

It is very important to enter the exact ID of your APP. Because this cause error (not show the error log, but nothing works fine because of this)

KonDeichmann
  • 878
  • 1
  • 8
  • 21
xhinoda
  • 1,032
  • 1
  • 19
  • 26
6

I can confirm that if you create an app in iTunes connect you get your app id before you submit it.

Therefore..

itms-apps://itunes.apple.com/app/id123456789

NSURL *appStoreURL = [NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id123456789"];
    if ([[UIApplication sharedApplication]canOpenURL:appStoreURL])
        [[UIApplication sharedApplication]openURL:appStoreURL];

Works a treat

user1641587
  • 121
  • 2
  • 2
5

I think Apple has provided a new link for the app link: https://apps.apple.com/app/id1445530088 or https://apps.apple.com/app/ {your_app_id}

Milon
  • 2,221
  • 23
  • 27
  • For website links, this is the way to go. Can't believe this URL is so ridiculously hard to find. – Magnus Aug 11 '20 at 12:31
  • this deep links into the App Store. the url with https://itunes.apple.com/app/appId redirects to https://apps.apple.com/app/appId . If you copy the URL from the App Store page it will give you a URL with the https://apps.apple.com domain. So to deeplink to apps on the App Store a URL like https://apps.apple.com/app/appId seems most up to date. – Samuël Jan 14 '21 at 13:46
4

Creating a link could become a complex issue when supporting multiple OS and multiple platform. For example the WebObjects isn't supported on iOS 7 (some of them), some links you create would open another country store then the user's etc.

There is an open source library called iLink that could help you.

There advantages of this library is that the links would be found and created at run time (the library would check the app ID and the OS it is running on and would figure out what link should be created). The best point in this is that you don't need to configure almost anything before using it so that is error free and would work always. That's great also if you have few targets on same project so you don't have to remember which app ID or link to use. This library also would prompt the user to upgrade the app if there is a new version on the store (this is built in and you turn this off by a simple flag) directly pointing to the upgrade page for the app if user agrees.

Copy the 2 library files to your project (iLink.h & iLink.m).

On your appDelegate.m:

#import "iLink.h"

+ (void)initialize
{
    //configure iLink
    [iLink sharedInstance].globalPromptForUpdate = YES; // If you want iLink to prompt user to update when the app is old.
}

and on the place you want to open the rating page for example just use:

[[iLink sharedInstance] iLinkOpenAppPageInAppStoreWithAppleID: YOUR_PAID_APP_APPLE_ID]; // You should find YOUR_PAID_APP_APPLE_ID from iTunes Connect 

Don't forget to import iLink.h on the same file.

There is a very good doc for the whole library there and an example projects for iPhone and for Mac.

Jameson
  • 76
  • 3
4

At least iOS 9 and above

  • Open directly in the App Store

An app

itms-apps://itunes.apple.com/app/[appName]/[appID]

List of developer's apps

itms-apps://itunes.apple.com/developer/[developerName]/[developerID]
Jakub Truhlář
  • 20,070
  • 9
  • 74
  • 84
4

According to Apple's latest document You need to use

appStoreLink = "https://itunes.apple.com/us/app/apple-store/id375380948?mt=8"  

or

SKStoreProductViewController 
Mihir Oza
  • 2,768
  • 3
  • 35
  • 61
  • Can you update your link please? This seems quite interesting if that won't work. – Rémy Virin Jun 07 '18 at 02:58
  • The linked document doesn't mention `itms:` or `itms-apps:`. Links using that scheme work fine on my devices running iOS 12. – Theo Nov 13 '18 at 10:57
4

Despite there being loads of answers here, none of the suggestions for linking to the developers apps seem to work anymore.

When I last visited I was able to get it working using the format:

itms-apps://itunes.apple.com/developer/developer-name/id123456789

This no longer works, but removing the developer name does:

itms-apps://itunes.apple.com/developer/id123456789
Leon
  • 3,614
  • 1
  • 33
  • 46
3

If you have the app store id you are best off using it. Especially if you in the future might change the name of the application.

http://itunes.apple.com/app/id378458261

If you don't have tha app store id you can create an url based on this documentation https://developer.apple.com/library/ios/qa/qa1633/_index.html

+ (NSURL *)appStoreURL
{
    static NSURL *appStoreURL;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        appStoreURL = [self appStoreURLFromBundleName:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]];
    });
    return appStoreURL;
}

+ (NSURL *)appStoreURLFromBundleName:(NSString *)bundleName
{
    NSURL *appStoreURL = [NSURL URLWithString:[NSString stringWithFormat:@"itms-apps://itunes.com/app/%@", [self sanitizeAppStoreResourceSpecifier:bundleName]]];
    return appStoreURL;
}

+ (NSString *)sanitizeAppStoreResourceSpecifier:(NSString *)resourceSpecifier
{
    /*
     https://developer.apple.com/library/ios/qa/qa1633/_index.html
     To create an App Store Short Link, apply the following rules to your company or app name:

     Remove all whitespace
     Convert all characters to lower-case
     Remove all copyright (©), trademark (™) and registered mark (®) symbols
     Replace ampersands ("&") with "and"
     Remove most punctuation (See Listing 2 for the set)
     Replace accented and other "decorated" characters (ü, å, etc.) with their elemental character (u, a, etc.)
     Leave all other characters as-is.
     */
    resourceSpecifier = [resourceSpecifier stringByReplacingOccurrencesOfString:@"&" withString:@"and"];
    resourceSpecifier = [[NSString alloc] initWithData:[resourceSpecifier dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES] encoding:NSASCIIStringEncoding];
    resourceSpecifier = [resourceSpecifier stringByReplacingOccurrencesOfString:@"[!¡\"#$%'()*+,-./:;<=>¿?@\\[\\]\\^_`{|}~\\s\\t\\n]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, resourceSpecifier.length)];
    resourceSpecifier = [resourceSpecifier lowercaseString];
    return resourceSpecifier;
}

Passes this test

- (void)testAppStoreURLFromBundleName
{
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Nuclear™"].absoluteString, @"itms-apps://itunes.com/app/nuclear", nil);
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Magazine+"].absoluteString, @"itms-apps://itunes.com/app/magazine", nil);
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Karl & CO"].absoluteString, @"itms-apps://itunes.com/app/karlandco", nil);
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"[Fluppy fuck]"].absoluteString, @"itms-apps://itunes.com/app/fluppyfuck", nil);
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Pollos Hérmanos"].absoluteString, @"itms-apps://itunes.com/app/polloshermanos", nil);
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Niños and niñas"].absoluteString, @"itms-apps://itunes.com/app/ninosandninas", nil);
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Trond, MobizMag"].absoluteString, @"itms-apps://itunes.com/app/trondmobizmag", nil);
    STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"!__SPECIAL-PLIZES__!"].absoluteString, @"itms-apps://itunes.com/app/specialplizes", nil);
}
hfossli
  • 22,616
  • 10
  • 116
  • 130
2

Most of the solutions here are outdated & deprecated

For those looking for the updated working solution

// let appStoreLink = "https://apps.apple.com/app/{app-name}/{app-id}"

guard let url = URL(string: Constants.App.appStoreLink) else { return }
UIApplication.shared.open(url)
tanmoy
  • 1,276
  • 1
  • 10
  • 28
  • 1
    This seems to work for me in 2023. It seems all the previous methods that did not also include the app-id no longer work. Using the itms-apps://apps.apple.com/app/{app-name}/{app-id} suffix on a Mac also works, and might be one less load in the browser. – mobob Mar 14 '23 at 10:02
1

it will open the App Store directly

NSString *iTunesLink = @"itms-apps://itunes.apple.com/app/ebl- 
skybanking/id1171655193?mt=8";

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
Biswajit Banik
  • 99
  • 2
  • 10
0

Try this way

http://itunes.apple.com/lookup?id="your app ID here" return json.From this, find key "trackViewUrl" and value is the desired url. use this url(just replace https:// with itms-apps://).This works just fine.

For example if your app ID is xyz then go to this link http://itunes.apple.com/lookup?id=xyz

Then find the url for key "trackViewUrl".This is the url for your app in app store and to use this url in xcode try this

NSString *iTunesLink = @"itms-apps://itunes.apple.com/us/app/Your app name/id Your app ID?mt=8&uo=4";
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];

Thanks

Szymon
  • 42,577
  • 16
  • 96
  • 114
Tunvir Rahman Tusher
  • 6,421
  • 2
  • 37
  • 32
0

in SwiftUI - IOS 15.0

//
//  Test.swift
//  PharmaCodex
//

import SwiftUI

struct Test: View {
    
    var body: some View {
        
        VStack {
            
            Button(action: {
                guard let writeReviewURL = URL(string: "https://apps.apple.com/app/id1629135515?action=write-review") else {
                    fatalError("Expected a valid URL")
                }
                UIApplication.shared.open(writeReviewURL, options: [:], completionHandler: nil)
                
            }) {
                Text("Rate/Review")
            }
            
            
        }
    }
}

struct Test_Previews: PreviewProvider {
    static var previews: some View {
        Test()
    }
}
Claudio Silva
  • 3,743
  • 1
  • 26
  • 27