简体   繁体   English

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

[英]How to link to Update page for our app

We prompt users to upgrade their app if they're running an outdated version.如果用户运行的是过时的版本,我们会提示用户升级他们的应用程序。 When users tap our update button, I use openURL with an address like itms://itunes.apple.com/us/app/our-app-title/id12345?mt=8 to load the App Store app to the listing for our app.当用户点击我们的更新按钮时,我使用带有类似itms://itunes.apple.com/us/app/our-app-title/id12345?mt=8的地址的 openURL 将 App Store 应用加载到我们的列表中应用程序。

With that method, however, the resulting screen has a button labeled "Open" not "Update."然而,使用这种方法,结果屏幕有一个标记为“打开”而不是“更新”的按钮。 If users open the App Store app first, then navigate to our app's listing (or go to the update tab), the button is labeled "Update."如果用户先打开 App Store 应用程序,然后导航到我们应用程序的列表(或转到更新选项卡),则该按钮将标记为“更新”。

Can I pass the current version as a querystring parameter in the openURL call or is there another way to make sure the Update button is shown?我可以在 openURL 调用中将当前版本作为查询字符串参数传递还是有另一种方法来确保显示更新按钮? I cannot find current documentation on how to do so.我找不到有关如何执行此操作的当前文档。 (Everything I find is a few years old and refers to the discontinued phobos tool.) (我发现的一切都是几年前的,指的是已停产的 phobos 工具。)

I would recommend you to try SKStoreProductViewController class. 我建议你尝试SKStoreProductViewController类。 iTunes item identifier can be found in https://itunesconnect.apple.com -> My Apps -> Apple ID . 可以在https://itunesconnect.apple.com - > 我的应用程序 - > Apple ID中找到iTunes项目标识符。

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

objective-c : 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 . 来自Apple开发者的新闻和公告

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. 使用iTunes链接在App Store上直接将您的应用程序驱动到您的应用程序通过iTunes链接,您可以直接从您的网站或营销活动中为您的客户提供在App Store上访问您的应用程序的简便方法。 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. 创建iTunes链接非常简单,可以将客户引导到单个应用程序,所有应用程序或指定公司名称的特定应用程序。

To send customers to a specific application: http://itunes.com/apps/appname 要将客户发送到特定应用程序: http//itunes.com/apps/appname

To send customers to a list of apps you have on the App Store: http://itunes.com/apps/developername 要将客户发送到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 要将客户发送到包含在URL中的公司名称的特定应用程序: http//itunes.com/apps/developername/appname

Additional notes: 补充笔记:

You can replace http:// with itms:// or itms-apps:// to avoid redirects. 您可以使用itms://itms-apps://替换http:// itms-apps://以避免重定向。

For info on naming, see Apple QA1633: 有关命名的信息,请参阅Apple QA1633:

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

Edit (as of January 2015): 编辑(截至2015年1月):

itunes.com/apps links should be updated to appstore.com/apps. itunes.com/apps链接应更新为appstore.com/apps。 See QA1633 above, which has been updated. 见上面的QA1633,已经更新。 A new QA1629 suggests these steps and code for launching the store from an app: 新的QA1629建议从应用程序启动商店的这些步骤和代码:

  1. Launch iTunes on your computer. 在您的计算机上启动iTunes。
  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. 右键单击或按住Control键并单击iTunes中项目的名称,然后从弹出菜单中选择“复制iTunes Store URL”。
  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. 在您的应用程序中,使用复制的iTunes URL创建NSURL对象,然后将此对象传递给UIApplication的openURL:方法,以在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 . 这里复制。

Just replace the 1166632935 with your app ID - Swift 4 只需将您的应用ID替换为1166632935 - Swift 4

UIApplication.shared.open(URL(string: "itms://itunes.apple.com/app/id1166632935")!, options: [:])

We inform our users to open the Updates tab on the App Store app and pull down to refresh if the UPDATE button isn't visible :/ 我们通知用户打开App Store应用程序上的“ Updates选项卡,如果看不到UPDATE按钮,请下拉刷新:/

I would like to provide an answer for the Xamarin user. 我想为Xamarin用户提供答案。 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. 然后,您调用此代码的控制器需要实现接口'ISKStoreProductViewControllerDelegate'以使“取消”按钮工作。 Then 'this' assignable to the 'Delegate' property. 然后'this'可分配给'Delegate'属性。

public partial class MyCurrentController : ISKStoreProductViewControllerDelegate {

        async void PromptForVersionUpgrade() { ... }

        [Export("productViewControllerDidFinish:")]
        public void Finished(SKStoreProductViewController controller)
        {
            controller.DismissViewController(true, null);
        }

        ...
}

appID = https://appstoreconnect.apple.com/ -> My Apps -> 'MyAPP' -> App Information -> under GeneralInformation section present Apple ID. appID = https://appstoreconnect.apple.com/ -> 我的应用程序 -> 'MyAPP' -> 应用程序信息 -> 在 GeneralInformation 部分下显示 Apple ID。

Swift 5:斯威夫特 5:

let params = [SKStoreProductParameterITunesItemIdentifier: appID]
let storeProductVC = SKStoreProductViewController()
storeProductVC.delegate = self
storeProductVC.loadProduct(withParameters: params)
self.present(storeProductVC, animated: true, completion: nil)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您如何直接链接到应用商店应用更新页面? - how do you link directly to app store app update page? 我们如何通知用户更新其企业应用程序 - How we notify our user to update their enterprise app 我们可以从我们的iOS应用程序显示指向Android订阅页面的链接吗? - Can we show a link to Android subscriptions page from our iOS app? 如何保护我们的应用程序 - How to secure our app 如何让 iOS/macOS 在其 NetworkExtension 运行时更新我们的应用程序? - How to let iOS/macOS update our app while its NetworkExtension is running? 如何在应用商店列表中添加语言-我们游戏的iTunes页面上无法看到更多语言 - How to add the languages in the app store listing - We are not able to see more languages on iTunes Page of our Game iOS/Swift - 有没有办法将我们的应用程序链接为 WhatsApp 消息? - iOS/Swift - Is there a way we can link our app as a WhatsApp message? 如何创建一个链接,该链接将在应用程序页面顶部打开应用程序和网络视图? - How to create a link that will open an app and a web view on top of the app page? 我们可以从我们的 ios 应用程序启动我们的应用程序设置页面吗? - Can we launch our app settings page from our ios app? 如何将我的应用程序链接到App Store开发人员页面? - How do I link my app to the App Store developer page?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM