首页 > 解决方案 > WebShare API 不在 iOS 上共享图像:Angular

问题描述

我正在使用 WebShare API 通过 Web 将图像本地共享到不同的应用程序。它在 Android 设备上运行良好,它们正在共享图像和文本。但是,iOS 中 Safari 上的相同 API 无法这样做。它仅共享与图像一起出现的文本,但图像本身丢失。

这是我的角度代码:

share() {
    if (this.windowNavigator.share) {
      this.windowNavigator
        .share({
          files: [this.file],
          title: "Title of the image",
          text: "Text to accompany the image",
        })
        .then(() => console.log("Share was successful."))
        .catch((error) => console.log("Sharing failed", error));
    } else {
      console.error("Cannot use Web Share API");
    }
  }

请帮我继续

标签: javascriptangulartypescript

解决方案


不支持通过 WebShare API 在 iOS 上共享文件。它仅在 Android 上受支持。


推荐阅读