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
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?
125 Answers
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:
To send customers to a list of apps you have on the App Store:
To send customers to a specific app with your company name included in the URL:
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:
Edit (as of January 2015):
links should be updated to See QA1633 above, which has been updated. A new QA1629 suggests these steps and code for launching the store from an app:
- Launch iTunes on your computer.
- Search for the item you want to link to.
- Right-click or control-click on the item's name in iTunes, then choose "Copy iTunes Store URL" from the pop-up menu.
- In your application, create an
NSURLobject with the copied iTunes URL, then pass this object toUIApplication' sopenURL: method to open your item in the App Store.
Sample code:
NSString *iTunesLink = @"itms://"; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]]; iOS10+:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink] options:@{} completionHandler:nil]; Swift 4.2
let urlStr = "itms-apps://" if #available(iOS 10.0, *) { UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil) } else { UIApplication.shared.openURL(URL(string: urlStr)!) } 36If 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://)
Hope that helps.
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
and there are no more redirects.
14Starting 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: "(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:@"", 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]]; 4Apple just announced the appstore.com urls.
3There are three types of App Store Short Links, in two forms, one for iOS apps, another for Mac Apps:
Company Name
App Name
App by Company
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
Activision Publishing, Inc. =>
Chen's Photography & Software =>
App Name examples
For summer 2015 onwards ...
-(IBAction)clickedUpdate { NSString *simple = @"itms-apps://"; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:simple]]; } replace 'id1234567890' with 'id' and 'your ten digit number'
This works perfectly on all devices.
It does go straight to the app store, no redirects.
Is OK for all national stores.
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.
To have a direct link without redirection :
- Use Apple Services Marketing Tools : to get the real direct link
- Replace the
https://withitms-apps:// - Open the link with
UIApplication.shared.open(url, options: [:])
Be careful, those links only works on actual devices, not in simulator.
Source :
3This 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://",[appName stringByReplacingOccurrencesOfString:@" " withString:@""]]]; Replace itms-apps with http on Mac:
NSURL *appStoreURL = [NSURL URLWithString:[NSString stringWithFormat:@"http:/",[appName stringByReplacingOccurrencesOfString:@" " withString:@""]]]; Open URL on iOS:
[[UIApplication sharedApplication] openURL:appStoreURL]; Mac:
[[NSWorkspace sharedWorkspace] openURL:appStoreURL]; 4Simply change 'itunes' to 'phobos' in the app link.
Now it will open the App Store directly
0This worked for me perfectly using only APP ID:
NSString *urlString = [NSString stringWithFormat:@"",YOUR_APP_ID]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]]; The number of redirects is ZERO.
0A 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 = @""; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]]; See 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.
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:// Otherwise it returns "This request cannot be processed" on iOS 4.3.3
3You can get a link to a specific item in the app store or iTunes through the link maker at:
1This is working and directly linking in ios5
NSString *iTunesLink = @""; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]]; All the answers are outdated and don't work; use the below method.
All apps of a developer:
itms-apps://
Single app:
itms-apps://
This is simple and short way to redirect/link other existing application on app store.
NSString *customURL = @""; if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]]) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]]; } For Xcode 9.1 and Swift 4:
- 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) } - How to use:
openStoreProductWithiTunesItemIdentifier(identifier: "here_put_your_App_id")
Note:
1It 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)
I can confirm that if you create an app in iTunes connect you get your app id before you submit it.
Therefore..
itms-apps:// NSURL *appStoreURL = [NSURL URLWithString:@"itms-apps://"]; if ([[UIApplication sharedApplication]canOpenURL:appStoreURL]) [[UIApplication sharedApplication]openURL:appStoreURL]; Works a treat
I think Apple has provided a new link for the app link: or {your_app_id}
2Creating 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.
At least iOS 9 and above
- Open directly in the App Store
An app
itms-apps:// List of developer's apps
itms-apps:// 1According to Apple's latest document You need to use
appStoreLink = "" or
SKStoreProductViewController 2Despite 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:// This no longer works, but removing the developer name does:
itms-apps:// 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.
If you don't have tha app store id you can create an url based on this documentation
+ (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://", [self sanitizeAppStoreResourceSpecifier:bundleName]]]; return appStoreURL; } + (NSString *)sanitizeAppStoreResourceSpecifier:(NSString *)resourceSpecifier { /* 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://", nil); STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Magazine+"].absoluteString, @"itms-apps://", nil); STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Karl & CO"].absoluteString, @"itms-apps://", nil); STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"[Fluppy fuck]"].absoluteString, @"itms-apps://", nil); STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Pollos Hérmanos"].absoluteString, @"itms-apps://", nil); STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Niños and niñas"].absoluteString, @"itms-apps://", nil); STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"Trond, MobizMag"].absoluteString, @"itms-apps://", nil); STAssertEqualObjects([AGApplicationHelper appStoreURLFromBundleName:@"!__SPECIAL-PLIZES__!"].absoluteString, @"itms-apps://", nil); } it will open the App Store directly
NSString *iTunesLink = @"itms-apps:// skybanking/id1171655193?mt=8"; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]]; Try this way
"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
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:// app name/id Your app ID?mt=8&uo=4"; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]]; Thanks