IOS快捷指令代码分享

IOS快捷指令分享

制作快捷指令

首先在快捷指令APP上制作快捷指令

添加一些逻辑,具体可以自己体验

IMG_1728

然后点击共享,获取iCloud链接

IMG_1729

类似于这种

https://www.icloud.com/shortcuts/02b1494ad19e49a29ce1189f0391a99a

可能在手机上分享会报未登录iCloud,但是也没给出登陆的地方,其实在设置里面是登陆了的,可以在Mac上跑一下,在Mac上做好快捷指令再分享也是一样的

将最后这个参数提取出来

跳转分享

在代码中通过URLScheme跳转

workflow://shortcuts/02b1494ad19e49a29ce1189f0391a99a

原生

        let url = "e6d47739563b4ff4bbf775679f1b72fe"
        let importString = "workflow://shortcuts/\(url)"
        print(importString)
        if let shortcutURL = URL(string: importString) {
            if UIApplication.shared.canOpenURL(shortcutURL) {
                UIApplication.shared.open(shortcutURL, options: [:], completionHandler: nil)
            } else {
                print("Could not open shortcut URL")
            }
        }

Flutter

const url = "e6d47739563b4ff4bbf775679f1b72fe";
    const importString = "workflow://shortcuts/$url";
    launchUrl(Uri.parse(importString));

IMG_13AAE6E889B3-1

posted @ 2023-05-25 14:36  R1cardo  阅读(968)  评论(0编辑  收藏  举报