Quantcast
Viewing all articles
Browse latest Browse all 6405

Cant download on iOS with expo-file-system

Im trying to download using Expo-File-System on an expo project with react native.

The download option works on Expo-Go during testing but wont work when i push it in production mode.

It says that it is "unable to save file in the local URI because you dont have Document Permissions" as shown in the Picture below.

Here is the code (Using typescript):

import * as MediaLibrary from 'expo-media-library';///For downloading the file  const download = async (item: ICurriculumCourseDocument) => {    setIsloading(true)    await FileSystem.downloadAsync(      `https:/baseUrl`,      FileSystem.documentDirectory + item.filename,      options    )      .then(({ uri }) => {        setIsloading(false)        console.log('Finished downloading to', uri);        onShareIOS(uri)      })      .catch(error => {        setIsloading(false)        alert(error);      });  }//For sharing the file using the Share  const onShareIOS = async (uri: string) => {    const imageFileExts = ['jpg', 'png', 'gif', 'heic', 'webp', 'bmp'];    if (imageFileExts.every(x => !uri.endsWith(x))) {      const UTI = 'public.item';      await Sharing.shareAsync(uri, {UTI});    }    };

Here is the full Alert with the error message:Image may be NSFW.
Clik here to view.
enter image description here


Viewing all articles
Browse latest Browse all 6405

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>