且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ionic 3:File_URI不允许加载本地资源IOS

更新时间:2022-11-16 22:59:30

我遇到了同样的问题,我意识到在iOS相机插件中返回带有新协议的协议来源但是当你在HTML中使用它来设置像img或视频这样的元素的来源时你需要删除协议...所以我做了:

I was facing same problem and I realized that in iOS camera plugin returns source with protocol for new captures but when using it in your HTML to set the source of an element like img or video you need to remove protocol... So I did :

if (isIos()) {
  itemSrc = itemSrc.replace(/^file:\/\//, '');
}

如果你想将捕获移动到其他地方恢复协议或预先复制或者其他什么

If you want to move capture to somewhere else restore protocol or make a copy beforehand or whatever

希望它有帮助