微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flutter iOS url 方案打开但当没有应用程序存在时,如果条件不起作用

如何解决Flutter iOS url 方案打开但当没有应用程序存在时,如果条件不起作用

A 和 B 是单独的应用程序。 我有一个应用程序,如果该应用程序存在,则需要访问 A,然后打开应用程序 A 或移至应用商店链接

如果应用程序存在,我需要访问 B,然后打开 App A 或移动到 AppStore 链接

 if (Platform.isAndroid) {
      _openApplication(
          pakageName: "com.xero.touch",storeLink:
              "https://play.google.com/store/apps/details?id=com.xero.touch&hl=en_IN&gl=US");
    } else if (Platform.isIOS) {
      launchIOSApp(
          storeLink:
              "https://apps.apple.com/us/app/xero-accounting/id441880705",storeSchema: "xero-business://");
    }

启动IOSApp

  void launchIOSApp({@required String storeSchema,@required String storeLink,}) async {
    if (await canLaunch(storeSchema)) {
      await launch(storeSchema);
    } else {
      await launch(storeLink);
    }
  }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。