swift - 将应用商店启动到特定的应用列表
问题描述
我的应用程序要求用户安装 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)
}
解决方案
@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)
}
}
推荐阅读
- dictionary - 在 Golang 中将命名类型 map[string]string 转换为普通类型
- javascript - 量角器茉莉花在错误/预期失败时捕获异常
- javascript - 从 Mongoose 的数组中删除一个对象
- python - 如何仅绘制具有某些数组值的单元格,而其他不使用 matplotlib.pyplot 的单元格?
- html - 为什么容器内的 div 元素默认不占用 12 列而只占用 1 列?
- database-design - 如何为图形数据库建模模式?
- c# - TreeView:绑定到分层数据
- microsoft-graph-api - Microsoft Graph API 中开始/时区的日历事件 $filter 查询
- javascript - 选择类别后调整大小
- c# - 如何使用从 C# 代码传递到 C++ 代码 (dll) 的字符串并带有 AccessViolationException