Ionic 3: File_URI Not allowed to load local IOS resource

Im using the camera to take a picture and view it. It needs to be sent to the server so that I use the destination type 'FILE_URI'. It works when I run it on Android, but Im getting this error by running it on ios 10.3.1

Unable to load local resource: file:///var/mobile/Containers/Data/Application/2CE518F3-4F4E-42A9-94E1-DC06D01250C7/tmp/cdv_photo_001.jpg

I do not run it with the -lc tag. Encoding Type: JPEG

+5
source share
2 answers

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

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

If you want to move the capture to another location, restore the protocol or make a copy in advance or something else

Hope this helps

+11
source

I ran the application in boot mode and ran into the same problem, and I tried this answer , going from operating mode to normal mode, solved the problem.

This should help you, as it helped me, at least for now.

+3
source

Source: https://habr.com/ru/post/1269488/


All Articles