Skip to content

[RNFetchBlobRequest] session didCompleteWithError (null) #208

Open
@ziyoshams

Description

@ziyoshams
  • please provide the version of installed library and RN project.
    "rn-fetch-blob": "github:joltup/rn-fetch-blob#master" .

  • a sample code snippet/repository is very helpful to spotting the problem.

Here is how I access my cache

AsyncStorage.getItem('imagePathCache')
      .then(val => {
        // Get the url => local path mappings
        if (!val) {
          this.isInitialized = true;
          return;
        }
        this.imagePathCache = JSON.parse(val);
        this.isInitialized = true;

        // Restore last session
        Object.keys(this.imagePathCache).forEach(url => {
          RNFetchBlob.session(CURRENT_USER_SESSION).add(
            this.imagePathCache[url].replace('<DOCUMENT_DIR>', RNFetchBlob.fs.dirs.DocumentDir)
          );
        });
      })
      .catch(err => {
        this.isInitialized = true;
      });

Here is how I CACHE things

createFetchImage = url => {
    return RNFetchBlob.config({
      fileCache: true,
      appendExt: 'jpg',
      session: CURRENT_USER_SESSION,
    })
      .fetch('GET', url, { 'Cache-Control': 'no-store' })
      .then(res => {
        const tmpFileURL = 'file://' + res.path();
        const relativeTmpFileLocation = tmpFileURL.replace(RNFetchBlob.fs.dirs.DocumentDir, '<DOCUMENT_DIR>');
        this.imagePathCache[url] = relativeTmpFileLocation;
        AsyncStorage.setItem('imagePathCache', JSON.stringify(this.imagePathCache));
        return tmpFileURL;
      });
  };

On iOS 12.0 we didn't have this issue. He are having this issue after upgrading to iOS 12.0.1. We are testing it on a physical device. Here is the exact log:
(QOS: UTILITY)][RNFetchBlobRequest.m:362] [RNFetchBlobRequest] session didBecomeInvalidWithError (null) .

I don't even know how to approach this. Any feedback or guidance is appreciated. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions