Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

initWithBase64EncodedString was thrown on RNFetchBlob

$
0
0

Getting an error when I try to upload an image to instagram through RNFetchBlob.

enter image description here

This is how I've implemented the upload function to instagram story

const shareStory = async (photoBase64: string, stickerBase64: string) => {  if (Platform.OS === 'ios') {    // ios seems to have problems with base64 type    const storyKey = Date.now()    const photoPath = `${RNFetchBlob.fs.dirs.CacheDir}/${storyKey}-photo`    const writeBase64ToFile = async (path:string, data: string) => {      const stream = await RNFetchBlob.fs.writeStream(path, 'base64', false)      await stream.write(data)    }    // Write base64 to cached    await writeBase64ToFile(photoPath, photoBase64)    console.log('photoPath:', photoPath)    await RNLegitStoryShare.shareToInstagram({      type: RNLegitStoryShare.FILE,      backgroundAsset: photoPath    });    // Delete cached files once used    await RNFetchBlob.fs.unlink(photoPath)  }

Viewing all articles
Browse latest Browse all 16750

Trending Articles



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