如何链接到我们的应用程序的更新页面

如果用户运行过时的版本,我们会提示用户升级他们的应用程序。 当用户点击我们的更新button,我使用openURL的地址itms://itunes.apple.com/us/app/our-app-title/id12345?mt=8加载App Store应用程序的列表为我们的应用程序。

然而,用这种方法,结果屏幕上有一个标记为“打开”而不是“更新”的button。 如果用户先打开App Store应用程序,然后导航到我们应用程序的列表(或转到更新选项卡),则该button标记为“更新”。

我可以在openURL调用中将当前版本作为查询stringparameter passing,还是有另一种方法来确保显示“更新”button? 我找不到目前的文件如何做到这一点。 (我find的所有东西都是几岁,指的是停止使用的phobos工具。)

我会build议你尝试SKStoreProductViewController类。 iTunes项目标识符可以在https://itunesconnect.apple.com – > 我的应用程序 – > Apple ID中find

迅速

 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

 - (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]; } 

从苹果开发者的新闻和公告 。

通过iTunes链接将客户直接带到App Store上的应用程序通过iTunes链接,您可以直接从您的网站或市场营销活动为您的客户提供在App Store上访问您的应用程序的简单方法。 创buildiTunes链接非常简单,可以将客户引导至单个应用程序,所有应用程序或指定了公司名称的特定应用程序。

要将客户发送到特定应用程序: http : //itunes.com/apps/appname

要将客户发送到App Store上的应用程序列表: http : //itunes.com/apps/developername

要将客户发送到包含在url中的公司名称的特定应用程序: http : //itunes.com/apps/developername/appname

补充笔记:

您可以用itms://itms-apps://replacehttp:// itms-apps://以避免redirect。

有关命名的信息,请参阅Apple QA1633:

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

编辑(截至2015年1月):

itunes.com/apps链接应该更新到appstore.com/apps。 参见上面已更新的QA1633。 一个新的QA1629build议这些步骤和代码从应用程序启动商店:

  1. 在电脑上启动iTunes。
  2. search您要链接到的项目。
  3. 在iTunes中右键单击或按住Control键并点按该项目的名称,然后从popup式菜单中select“复制iTunes Store URL”。
  4. 在您的应用程序中,使用复制的iTunes URL创buildNSURL对象,然后将此对象传递给UIApplication的openURL:方法以在App Store中打开您的项目。

示例代码:

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

从这里复制。

我想为Xamarin用户提供一个答案。 以下将提出一个警报提供更新,然后把用户带到商店。

 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); } 

那么你从这个代码调用的控制器将需要实现接口“ISKStoreProductViewControllerDelegate”,使“取消”button的工作。 然后“this”可赋值给“Delegate”属性。

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