为什么使用最新的 url_launcher 6.1.2 不适用于 pdf 而以前的版本可以?

Why using the latest url_launcher 6.1.2 not work with pdfs but previous version does?

我正在尝试使用 url_launcher 6.1.2 https://pub.dev/packages/url_launcher/changelog 打开 pdf links 以及我的网络视图中的网站

这是我正在尝试的 link https://www.bseindia.com/xml-data/corpfiling/AttachHis/50710d0d-10c7-407b-84c3-86a0b8aae229.pdf

当我使用launchUrl(Uri.parse(url));launchUrlString(url)

我得到一个空白的白屏并且

错误日志显示

E/FrameEvents(32530): updateAcquireFence: Did not find frame.

                                                       

但是,如果我使用 6.0.20 版本

launch(url);

然后就可以了,

但我不想使用它,因为它现在已经贬值了,

我已经在清单中添加了

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

launch() 已弃用,您必须使用 launchUrl().

launchUrl(
       Uri.parse("https://www.bseindia.com/xml-data/corpfiling/AttachHis/50710d0d-10c7-407b-84c3-86a0b8aae229.pdf"),
       mode: LaunchMode.externalApplication,
)

试试这个,对我来说完全没问题。

您还必须在清单中添加以下内容。

<queries>
  <!-- If your app opens https URLs -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="https" />
  </intent>
  <!-- If your app makes calls -->
  <intent>
    <action android:name="android.intent.action.DIAL" />
    <data android:scheme="tel" />
  </intent>
  <!-- If your sends SMS messages -->
  <intent>
    <action android:name="android.intent.action.SENDTO" />
    <data android:scheme="smsto" />
  </intent>
  <!-- If your app sends emails -->
  <intent>
    <action android:name="android.intent.action.SEND" />
    <data android:mimeType="*/*" />
  </intent>
</queries>

link 用于文档:https://pub.dev/packages/url_launcher