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

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

问题描述

如果用户运行的是过时版本,我们会提示用户升级他们的应用.当用户点击我们的更新按钮时,我使用 openURL 和类似 itms://itunes.apple.com/us/app/our-app-title/id12345?mt=8 的地址来加载应用程序将应用程序存储到我们应用程序的列表中.

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 调用中将当前版本作为查询字符串参数传递还是有其他方法来确保显示更新按钮?我找不到有关如何执行此操作的当前文档.(我发现的所有东西都是几年前的,指的是已停产的 phobos 工具.)

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 类.iTunes 项目标识符可以在 https://itunesconnect.apple.com -> 我的应用程序 中找到强> -> 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天全站免登陆