FileSystem copyAsync not working in iOS and Expo 50

53 Views Asked by At

I have the following code with a React Native in iOS, using Expo 50.

const uri = photo.uri; // an example of this value is ph://ED7AC36B-A150-4C38-BB8C-B6D696F4F2ED

const uriParts = uri.split(".");
const fileType = uriParts[uriParts.length - 1];
const time = new Date().getTime();

const newUri = `${FileSystem.documentDirectory}/${time}.${fileType}`

await FileSystem.copyAsync({
   from: uri,
   to: newUri,
});

I'm getting the following error:

Error: Calling the 'copyAsync' function has failed
→ Caused by: File '' is not readable
Error: Calling the 'copyAsync' function has failed
→ Caused by: File '' is not readable
    at construct (native)
    at apply (native)
    at _construct (http://10.0.0.216:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:10005:28)
    at Wrapper (http://10.0.0.216:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9963:25)
    at construct (native)
    at _createSuperInternal (http://10.0.0.216:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:133159:322)
    at call (native)
    at CodedError (http://10.0.0.216:8081/index.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:133172:26)

Anyone with similar experience?

0

There are 0 best solutions below