본문 바로가기
모바일개발(Mobile Dev)/IOS개발(ObjectC)

How to make itunes app url link address

by 테크한스 2016. 1. 23.
반응형




http://itunes.apple.com/linkmaker/




written by http://stackoverflow.com/questions/433907/how-to-link-to-apps-on-the-app-store



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?

shareimprove this question
up vote509down voteaccepted

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.

For info on naming, see Apple QA1633:

https://developer.apple.com/library/ios/#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/us/app/apple-store/id375380948?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
shareimprove this answer
134 
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 1:59
11 
See: developer.apple.com/library/ios/#qa/qa1633/_index.html (White space should just be removed.) – Nathan S. Apr 18 '11 at 2:53
7 
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 0:51
11 
This should be tested on a real device. – Protocole Feb 7 '12 at 9:31
5 
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

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://)

Hope that helps.


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.

shareimprove this answer
4 
This is an excellent tip. – William Denniss Jan 15 '11 at 5:49
   
I don't think this is necessary any longer. I use http in my app and it goes straight to the App Store app. – PEZJan 17 '11 at 19:55
1 
@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 3 '11 at 7:20
   
I admit, i didn't trace the requests. =) I'll change to imts-apps too now. – PEZ Feb 3 '11 at 9:04
3 
Rocotilos, are you sure this no longer works? Can you post a link? – johndodo May 19 '13 at 17:33

To be extreamly concise:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/appname"]];

If you want to send to all the apps for a developer, use

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/developername"]];

These work for iOS 4.1

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:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.com/apps/DevelopmentCompanyLLC"]];

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

shareimprove this answer
2 
THAT'S the answer I was looking for! – Olie Mar 1 '11 at 0:29
2 
This doesn't work on iOS 6.0.1. It links to iTunes, not AppStore app, and will display a Item Not Foundscreen :/ – Hlung Nov 30 '12 at 9:42 
   
Hlung, I'm running iOS 6.0.1 on my iPhone5 and my deployed app links to the App Store just fine, are you sure that you have the correct URL? – Intentss Dec 1 '12 at 5:33
6 
@Hlung Don't try this on the simulator as this will - of course - not work, because there is no AppStore in simulator... on the device it works. – jimpic Apr 11 '13 at 6:41
   
the appname is working for me and opening the app page but developername is not working.Is there something to change. – Imran Mar 12 '14 at 10: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];
shareimprove this answer
   
This works, but you also have to remove special characters like dashes from the app name. – Macondo2Seattle Apr 30 '12 at 17:27
   
Thank you @3 revs and @BlackRider – Ganesh Guturi Mar 19 '13 at 11:30
   
Can we open and show all the apps uploaded by the developer in one page? – Imran Mar 12 '14 at 10:56
   
This was the only drop-in solution that worked for me with minimum redirects and maximum handling of app name whitespace. – LordParsley Apr 22 '15 at 15:42

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

shareimprove this answer
3 
This doesn't seem to work anymore with 3.0. – JamesSugrue Jul 20 '09 at 21:28
3 
   
Works like a champ on 3.1. – runako Oct 11 '09 at 21:44
4 
itms:// is the protocol handler for appstore links... – jb. Mar 7 '10 at 7:27

To have a direct link without redirection :

  1. Use iTunes link maker http://itunes.apple.com/linkmaker/ to get the real direct link
  2. Replace the http:// with itms-apps://
  3. Open the link with [[UIApplication sharedApplication] openURL:url];

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

Source : https://developer.apple.com/library/ios/#qa/qa2008/qa1629.html

shareimprove this answer
4 
2 
+1 for itunes.apple.com/linkmaker,everyone test the link in device not in simulator, I was wasting time in testing simulator. – karthik Sep 3 '13 at 10:43
1 
Thanks for info about Simulator, I'll add this to the answer – dulgan Sep 3 '13 at 14:39

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

shareimprove this answer
1 
this is actually the only thing that still works reliable for mac store at least – Radu Simionescu Oct 19 '15 at 0: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 at 22:52

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.

shareimprove this answer
3 
works for me on iOS 6.0.1 :) – Hlung Nov 30 '12 at 9:44 

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

shareimprove this answer
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: 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 7 '12 at 8:50 
   
that is THE prefect answer! – Sam B Mar 1 '13 at 23:50

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.

shareimprove this answer

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

shareimprove this answer
   
Also, for directing to your developer page (if you want to show the user your catalogue of apps) you can use: NSString *simple = @"itms-apps://itunes.com/apps/YOUR_COMPANY_NAME"; – TheBestBigAl Aug 18 '15 at 9:49

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/

shareimprove this answer
   
This one help me, because the link in my itunes-connect didn't work, and in the generator it does. thank you – dorad Nov 6 '15 at 12:10

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]];
shareimprove this answer

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]];
 } 
shareimprove this answer

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.

shareimprove this answer

Starting from iOS 6 right way to go is using SKStoreProductViewController class. Code snippet is below.

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];
}
shareimprove this answer

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

shareimprove this answer

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

shareimprove this answer

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 documentationhttps://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);
}
shareimprove this answer


반응형