首页 > 解决方案 > 将应用商店启动到特定的应用列表

问题描述

我的应用程序要求用户安装 Apple Pages。如果没有安装,我会启动应用商店让他们安装页面。有什么我可以附加到“com.apple.AppStore”捆绑 ID 以将其打开到应用商店页面列表。

这是应用商店页面的 网址 https://apps.apple.com/us/app/pages/id409201541?mt=12

if let appStoreURL =  NSWorkspace.shared.urlForApplication(withBundleIdentifier: "com.apple.AppStore") {             
    NSWorkspace.shared.open(appStoreURL)
}

标签: swiftmacoscocoa

解决方案


@IBAction func itunesClicked(_ sender: NSButton) {
    let access = "macappstore://itunes.apple.com/app/id"
    let appIdee = "409201541"
    let more = "?mt=12"
    let str: String = access + appIdee + more
    if let urlStr = URL(string: str) {
        NSWorkspace.shared.open(urlStr)
    }
}

如果您想发表评论...

@IBAction func itunesClicked(_ sender: NSButton) {
    let access = "macappstore://itunes.apple.com/app/id"
    let appIdee = "409201541"
    let more = "?action=write-review&mt=8"
    let str: String = access + appIdee + more
    if let urlStr = URL(string: str) {
        NSWorkspace.shared.open(urlStr)
    }
}

推荐阅读