joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 772 forks source link

value for title cannot be cast from readablenativemap to string #547

Closed DevJett closed 4 years ago

DevJett commented 4 years ago
  let options = {
            fileCache: true,
            appendExt : ext,
            IOSBackgroundTask: true,
            trusty : true,
            addAndroidDownloads : {
                useDownloadManager : true,
                notification : true,
                path:  fs.dirs[path] +"/"+row.fileName.slice(0, row.fileName.length -5)+'_'+Math.floor(date.getTime() + date.getSeconds() / 2)+'.'+ext,
                description : row.fileType.slice(0, 5),
                mime: row.fileType,
            }
        };

        config(options).fetch('GET', linkDownload ).then((res) => {
            console.log(res)
        }).catch((e) => {
            console.log(e)
        });

I'm getting this error

value for title cannot be cast from readablenativemap to string

if I change fetch to this

fetch(linkDownload, {
    method: 'GET',
  })

I will get different error this

com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.String

Can anybody help me with this? thank you for your time.

DevJett commented 4 years ago

I fixed the problem, the url wasn't a string

asgaraliyev commented 3 years ago
  • "rn-fetch-blob": "^0.10.15",
  • "react": "16.8.3",
  • "react-native": "^0.59.10",
  let options = {
            fileCache: true,
            appendExt : ext,
            IOSBackgroundTask: true,
            trusty : true,
            addAndroidDownloads : {
                useDownloadManager : true,
                notification : true,
                path:  fs.dirs[path] +"/"+row.fileName.slice(0, row.fileName.length -5)+'_'+Math.floor(date.getTime() + date.getSeconds() / 2)+'.'+ext,
                description : row.fileType.slice(0, 5),
                mime: row.fileType,
            }
        };

        config(options).fetch('GET', linkDownload ).then((res) => {
            console.log(res)
        }).catch((e) => {
            console.log(e)
        });

I'm getting this error

value for title cannot be cast from readablenativemap to string

if I change fetch to this

fetch(linkDownload, {
    method: 'GET',
  })

I will get different error this

com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.String

Can anybody help me with this? thank you for your time.

Sorry.I cant see your rn-fetch-blob codes .can I download any file without rn-fetch-blob?

Piyush132000 commented 3 years ago

Hlo I am also getting same error value for title cannot be cast from readablenativemap to string

if any one know answer please reply