如何链接到网页更新为我们的应用程序 [英] How to link to Update page for our app

查看:280
本文介绍了如何链接到网页更新为我们的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们提示用户,如果他们正在运行一个过时的版本升级他们的应用程序。当用户点击我们的更新按钮,我使用的OpenURL像 ITMS地址://itunes.apple.com/us/app/our-app-title/id12345 MT = 8 到App Store的应用程序加载,为我们的应用程序列表。

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.

通过这种方法,但是,结果屏幕上有标注为打开不是一个按钮更新。如果用户首次打开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."

我可以通过当前版本中的OpenURL调用查询字符串参数或有另一种方式,以确保更新按钮显示?我无法找到如何做到这一点当前文档。 (一切我觉得是几年老指停产火卫一的工具。)

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? 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.)

推荐答案

我会建议你尝试 SKStoreProductViewController 类。 > 我的应用 https://itunesconnect.apple.com 找到STRONG> - > 的Apple ID

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

迅捷

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

这篇关于如何链接到网页更新为我们的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆