【问题标题】:ERROR Error: Uncaught (in promise): Asset '/storage/emulated/0/DCIM/Restored/IMG_20200115_103131.jpg' cannot be foundERROR 错误:未捕获(承诺):找不到资产“/storage/emulated/0/DCIM/Restored/IMG_20200115_103131.jpg”
【发布时间】:2020-10-07 19:22:59
【问题描述】:

在nativescript应用上工作,需要访问图像并将其转换为base64。

.then(function(selection) {
    selection.forEach(function (selected) {
        imageSourceModule
        .fromAsset(selected)
        .then((imageSource) => {
            var imageBase64 = imageSource.toBase64String("jpg",60);
            console.log(imageBase64);

【问题讨论】:

  • 它是递归的,因此,您可能需要在对资产进行 操作之前找到资产。换句话说,你的外部代码块比你的内部代码块运行得更快。

标签: angular nativescript imagesource


【解决方案1】:

fromAsset 遇到了同样的问题,我通过这样做解决了它。

<application
  ...
    android:requestLegacyExternalStorage="true"
  ...
</application>

【讨论】:

    猜你喜欢
    • 2017-10-05
    • 1970-01-01
    • 1970-01-01
    • 2022-11-11
    • 2021-07-14
    • 2018-06-06
    • 2017-10-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多