How to link to Update page for our app How to link to Update page for our app ios ios

How to link to Update page for our app


I would recommend you to try SKStoreProductViewController class. iTunes item identifier can be found in https://itunesconnect.apple.com -> My Apps -> Apple ID.

swift:

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)}// UsageopenStoreProductWithiTunesItemIdentifier("2321354")

objective-c:

- (void)openStoreProductViewControllerWithITunesItemIdentifier:(NSInteger)iTunesItemIdentifier {    SKStoreProductViewController *storeViewController = [[SKStoreProductViewController alloc] init];    storeViewController.delegate = self;    NSNumber *identifier = [NSNumber numberWithInteger:iTunesItemIdentifier];    NSDictionary *parameters = @{ SKStoreProductParameterITunesItemIdentifier:identifier };    UIViewController *viewController = [self topViewController];    [storeViewController loadProductWithParameters:parameters                                   completionBlock:^(BOOL result, NSError *error) {                                       if (!result) {                                           NSLog(@"SKStoreProductViewController: %@", error);                                       }                                   }];    [viewController presentViewController:storeViewController animated:YES completion:nil];    [storeViewController release];}


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, thenchoose "Copy iTunes Store URL" from the pop-up menu.
  4. In your application, create an NSURL object with the copied iTunesURL, then pass this object to UIApplication' s openURL: method toopen 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]];

Copied from here.


I would like to provide an answer for the Xamarin user. The following would bring up an alert offering to update and then take the user to the store.

async void PromptForVersionUpgrade(){        var alertController = UIAlertController.Create(Messages.NewVersionTitle, Messages.NewVersionText, UIAlertControllerStyle.Alert);        alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));        alertController.AddAction(UIAlertAction.Create(Messages.NewVersionGoToAppStore, UIAlertActionStyle.Default, (obj) =>        {            var storeViewController = new SKStoreProductViewController();            storeViewController.Delegate = this;            storeViewController.LoadProduct(new StoreProductParameters { ITunesItemIdentifier = 999999999 }, (isLoaded, error) =>            {                if (isLoaded)                    PresentViewController(storeViewController, true, null);            });        }));        PresentViewController(alertController, true, null);}

Then the controller you are calling this code from would need to implement the interface 'ISKStoreProductViewControllerDelegate' to make the 'Cancel' button work. Then 'this' assignable to the 'Delegate' property.

public partial class MyCurrentController : ISKStoreProductViewControllerDelegate {        async void PromptForVersionUpgrade() { ... }        [Export("productViewControllerDidFinish:")]        public void Finished(SKStoreProductViewController controller)        {            controller.DismissViewController(true, null);        }        ...}