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

通过 flutter 无法使用 iOS 的参数打开另一个应用程序

如何解决通过 flutter 无法使用 iOS 的参数打开另一个应用程序

我使用deeplink通过Flutter打开另一个应用程序。 我使用 lib external_app_launcher

如果我只使用scheme,打开另一个应用程序,如果我在scheme中传递参数,它不起作用。

我还使用了 url_launch、Flutter_appavailability 库,但它们不适用于 iOS。

请帮我解决
提前致谢!!!

如果我使用:

  • iosUrlScheme: 'myscheme:// - 运行良好,打开了另一个应用程序
  • iosUrlScheme: 'myscheme://abc.com?arg1=1234 - 它效果不佳,打开了另一个应用程序

示例代码

信息拆分

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>myscheme</string> app
</array>

MyWidget

@override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),),body: Center(
          child: Container(
            height: 50,width: 150,child: RaisedButton(
                color: Colors.blue,onpressed: () async {
                  await LaunchApp.openApp(
                    androidPackageName: 'my.package.name',iosUrlScheme: 'myscheme://abc.com?arg=1234',openStore: false
                  );
                  // Enter thr package name of the App you  want to open and for iOS add the     URLscheme to the Info.plist file.
                  // The second arguments decide wether the     app redirects PlayStore or AppStore.
                  // For testing purpose you can enter com. instagram.android
                },child: Container(
                    child: Center(
                  child: Text(
                    "Open",textAlign: TextAlign.center,))),);
  }
}

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