alpha0010 / react-native-file-access

Filesystem access for React Native
MIT License
298 stars 18 forks source link

Fatal error: Unexpectedly found nil while unwrapping an Optional value #59

Closed jamninetyfive closed 1 year ago

jamninetyfive commented 1 year ago

react-native: 0.70.6 react-native-file-access: 2.5.0 Platform: iOS

Bug A clear and concise description of what the bug is.

To reproduce Describe how to trigger this bug.

Details Logs, code snippets, screenshots, extended bug description.

when i writeFile with base64 to png, i got this error.

image

jamninetyfive commented 1 year ago

need help.

data was base64 why got nil .

path :/var/mobile/Containers/Data/Application/EC6573D6-86F2-4A5C-AD1D-79F20CFE9316/Library/Caches/XXX.png

alpha0010 commented 1 year ago

The error is due to the prefix data:image/png;base64, is not valid base64. You should pass only the data part iVBORw....

That said, this is supposed create an error message, not crash the app.

jamninetyfive commented 1 year ago

same. The first thing I tried was not data: image/png; base64. got crash.

Base64 data from react-native-qrcode-svg toDataURL

when i add data: image/png; base64 to iVBORw it work in there. https://products.aspose.app/imaging/zh-hans/conversion/base64-to-png

jamninetyfive commented 1 year ago

fixed #60